/** * Get commissions as string * * @return null|string */ public function getCommissionsAsString() { $commissions = array(); if ($this->model->getOwner()->hasRole('ROLE_RIA')) { $commissions = $this->getTransactionCommissionFees(); } elseif ($this->model->getOwner()->hasRole('ROLE_CLIENT')) { $commissions = $this->getModel()->getCommissions(); } $resultStr = null; if (!empty($commissions)) { if ($commissions[0] == $commissions[1]) { if (!$commissions[0]) { return $resultStr; } unset($commissions[1]); } $strCommissions = array_map(function ($item) { return '$' . number_format($item, 2); }, $commissions); $resultStr = join(' - ', $strCommissions); } return $resultStr; }
/** * Get child models by parent model * * @param CeModelInterface $parent * @return mixed */ public function getChildModels(CeModelInterface $parent) { $ownerId = $parent->getOwnerId() ? $parent->getOwnerId() : ($parent->getOwner() ? $parent->getOwner()->getId() : null); return $this->getChildModelsByParentIdAndOwnerId($parent->getId(), $ownerId); }