public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $this->factory = $builder->getFormFactory();
     $client = $this->account->getClient();
     $builder->add('bankInformation', 'entity', array('class' => 'WealthbotClientBundle:BankInformation', 'query_builder' => function (EntityRepository $er) use($client) {
         return $er->createQueryBuilder('bi')->where('bi.client_id = :client_id')->setParameter('client_id', $client->getId());
     }, 'expanded' => true, 'multiple' => false))->add('amount', 'number', array('precision' => 2, 'grouping' => true, 'required' => false));
     if (null !== $this->subscriber) {
         $builder->addEventSubscriber($this->subscriber);
     }
     $builder->addEventListener(FormEvents::PRE_SET_DATA, array($this, 'onPreSetData'));
 }
 public function getOneBySecurityAndAccount(Security $security, SystemAccount $systemAccount)
 {
     $qb = $this->createQueryBuilder('s')->leftJoin('s.subclass', 'sc')->where('sc.owner = :ria')->setParameter('ria', $systemAccount->getClient()->getRia())->andWhere('s.security = :security')->setParameter('security', $security);
     return $qb->getQuery()->getOneOrNullResult();
 }