/** * @param User $client * @param bool $isClientView * @return array */ public function getAccountsForClient(User $client, $isClientView = false) { if ($isClientView) { $accounts = $this->em->getRepository('WealthbotClientBundle:SystemAccount')->findByClientIdAndNotStatus($client->getId(), SystemAccount::STATUS_CLOSED); } else { $accounts = $client->getSystemAccounts()->toArray(); } return $accounts; }
public function __construct(User $client, array $systemAccounts = null) { if (null === $systemAccounts) { $systemAccounts = $client->getSystemAccounts(); } /** @var SystemAccount $systemAccount */ foreach ($systemAccounts as $systemAccount) { $clientAccount = $systemAccount->getClientAccount(); $this->clientAccounts[$clientAccount->getId()] = $clientAccount->getSasCash(); } }