示例#1
0
 public function load(ObjectManager $manager)
 {
     foreach ($this->groups as $groupName) {
         $groupObject = new AccountGroup();
         $groupObject->setName($groupName);
         $manager->persist($groupObject);
         $this->addReference('client-account-group-' . $groupName, $groupObject);
     }
     foreach ($this->types as $key => $item) {
         $typeObject = new AccountType();
         $typeObject->setName($item['name']);
         $manager->persist($typeObject);
         $this->addReference('client-account-type-' . ($key + 1), $typeObject);
         foreach ($item['groups'] as $groupKey) {
             $groupTypeObject = new AccountGroupType();
             $groupTypeObject->setGroup($this->getReference('client-account-group-' . $groupKey));
             $groupTypeObject->setType($this->getReference('client-account-type-' . ($key + 1)));
             $manager->persist($groupTypeObject);
             $this->addReference('client-account-group-type-' . $groupKey . '-' . ($key + 1), $groupTypeObject);
         }
     }
     $manager->flush();
 }
 private function updateOwnersField(FormInterface $form, AccountGroupType $groupType, ClientAccount $account = null)
 {
     $isJoint = $groupType->getType() && $groupType->getType()->getName() == 'Joint Account';
     if ($this->client->isMarried() || $isJoint) {
         $form->add($this->factory->createNamed('owners', new RiaClientAccountOwnerFormType($this->client, $account, $isJoint), null, array('mapped' => false)));
     }
 }
 /**
  * Save account group type in the session
  *
  * @param AccountGroupType $groupType
  */
 private function setAccountGroupType(AccountGroupType $groupType)
 {
     $this->get('session')->set('client.accounts.account_group_type_id', $groupType->getId());
 }