public function buildTransactionParams(Account $acc, $fromID = null)
 {
     $params = ['accountKey' => $acc->getDivision(), 'rowCount' => 2000];
     if ($fromID) {
         $params = array_merge($params, ['fromID' => $fromID]);
     }
     return $params;
 }
 public function setAccount(Account $account)
 {
     $this->account = $account;
     if ($account->getOrganization() !== $this) {
         $account->setOrganization($this);
     }
     return $this;
 }
 /**
  * Creates a new Account entity.
  *
  * @Route("/", name="account_create")
  * @Method("POST")
  * @Template("AppBundle:Account:new.html.twig")
  */
 public function createAction(Request $request)
 {
     $em = $this->getDoctrine()->getManager();
     $account = new Account();
     $account->setName($request->get('name'));
     $account->setTechnologyDescription($request->get('technologyDescription'));
     $account->setLeaderName($request->get('leaderName'));
     $em->persist($account);
     $em->flush();
     return $this->redirectToRoute('account');
 }
 protected function createAndPersistData()
 {
     for ($i = 1; $i <= self::ACCOUNTS_COUNT; $i++) {
         $account = new Account();
         $account->setActive(true);
         $account->setEmail(sprintf('*****@*****.**', $i));
         $account->setPassword('password');
         $this->manager->persist($account);
         $this->setReference(sprintf('account_%s', $i), $account);
     }
 }
Exemple #5
0
 public function load(ObjectManager $manager)
 {
     $accounts = array(array('name' => 'Playboy', 'leaderName' => 'Joaquin Lopez', 'technologyDescription' => '.NET'), array('name' => 'Tecate', 'leaderName' => 'Joaquin Lopez', 'technologyDescription' => '.NET'), array('name' => 'Sony', 'leaderName' => 'Joaquin Lopez', 'technologyDescription' => '.NET'), array('name' => 'Fandango', 'leaderName' => 'Joaquin Lopez', 'technologyDescription' => '.NET'), array('name' => 'Nintendo', 'leaderName' => 'Joaquin Lopez', 'technologyDescription' => '.NET'), array('name' => 'Insurance', 'leaderName' => 'Joaquin Lopez', 'technologyDescription' => '.NET'), array('name' => 'Coca-Cola', 'leaderName' => 'Joaquin Lopez', 'technologyDescription' => '.NET'));
     foreach ($accounts as $account) {
         $entity = new Account();
         $entity->setName($account['name']);
         $entity->setLeaderName($account['leaderName']);
         $entity->setTechnologyDescription($account['technologyDescription']);
         $manager->persist($entity);
     }
     $manager->flush();
 }
 public function mapList($items, array $options)
 {
     $repo = $this->doctrine->getRepository('AppBundle:Account');
     $corp = isset($options['corp']) ? $options['corp'] : false;
     if (!$corp instanceof Corporation) {
         throw new OptionDefinitionException(sprintf('Option corp required and must by of type %s, got %s', get_class(new Corporation())));
     }
     foreach ($items as $a) {
         $exists = $repo->findOneBy(['corporation' => $corp, 'division' => $a->accountKey]);
         if (!$exists instanceof Account) {
             $account = new Account();
             $account->setEveAccountId($a->accountID)->setDivision($a->accountKey);
         } else {
             $account = $exists;
         }
         $balance = $this->mapItem($a);
         $account->addBalance($balance);
         if (!$exists instanceof Account) {
             $options['corp']->addAccount($account);
         }
     }
 }
 public function initializeAccounts($accounts, Corporation $corp)
 {
     foreach ($accounts as $a) {
         if (intval($a->accountKey) <= 1006) {
             $exists = $this->doctrine->getRepository('AppBundle:Account')->findOneBy(['corporation' => $corp, 'division' => $a->accountKey]);
             if ($exists instanceof Account) {
                 $exists->setName($a->description);
             } else {
                 $account = new Account();
                 $account->setDivision($a->accountKey)->setName($a->description);
                 $corp->addAccount($account);
             }
         }
     }
 }
 /**
  * @Route("login")
  * @Route("/login")
  * @Route("/login/")
  * @Route("/login/{w}")
  */
 public function loginAction(Request $request, $w = null)
 {
     $account = new Account();
     $account->setUsername('vin');
     $account->setPassword('password');
     $form = $this->createForm(new LoginType(), $account, array('action' => "", 'method' => 'POST'));
     $form->handleRequest($request);
     if ($form->isValid()) {
         return $this->forward('AppBundle:Twitter:verifyLogin', array('getUsername' => $account->getUsername(), 'getPassword' => $account->getPassword()));
     }
     if (isset($w)) {
         return $this->render('twitter/login.html.twig', array('current_year' => date("Y"), 'login_form' => $form->createView(), 'msg' => "Wrong credentials. Please try again!"));
     } else {
         return $this->render('twitter/login.html.twig', array('current_year' => date("Y"), 'login_form' => $form->createView(), 'msg' => null));
     }
 }