Repo/Dao/Account.php
public function getByCustomerId($customerId, $assetTypeId)
    {
        $result = null;
        $where = '(' . Entity::A_CUST_ID . '=' . (int)$customerId . ')';
        $where = "$where AND (" . Entity::A_ASSET_TYPE_ID . '=' . (int)$assetTypeId . ')';
        $found = $this->get($where);
        if ($found && count($found)) {
            $result = reset($found);
        } else {
            /* there is no account for this customer/asset */
            $entity = new Entity();
            $entity->setCustomerId($customerId);
            $entity->setAssetTypeId($assetTypeId);
            $accId = $this->create($entity);
            $result = $this->getById($accId);
        }
        return $result;
    }
public function getByCustomerId($customerId, $assetTypeId)
    {
        $result = null;
        $where = '(' . Entity::A_CUST_ID . '=' . (int)$customerId . ')';
        $where = "$where AND (" . Entity::A_ASSET_TYPE_ID . '=' . (int)$assetTypeId . ')';
        $found = $this->get($where);
        if ($found && count($found)) {
            $result = reset($found);
        } else {
            /* there is no account for this customer/asset */
            $entity = new Entity();
            $entity->setCustomerId($customerId);
            $entity->setAssetTypeId($assetTypeId);
            $accId = $this->create($entity);
            $result = $this->getById($accId);
        }
        return $result;
    }
Get account data for the $customerId by $assetTypeId. Create new one if there is no account for this
customer/asset.

@param int $customerId
@param int $assetTypeId
@return \Praxigento\Accounting\Repo\Data\Account|null