Example #1
0
 public function load(ObjectManager $manager)
 {
     $acc1 = new Account();
     $acc1->setWithdrawAddress('ms75uVn7bkC2aDoMGWtoKnCiFLvvCWkhPA');
     $acc1->setDepositAddress('mwD4ax4J25ZGwvhht3PDhemBKRyj4qsCZ7');
     $manager->persist($acc1);
     $acc2 = new Account();
     $acc2->setWithdrawAddress('mnm4M2DFaDAWmLNfQ2dJXxXpofbzhqXvUM');
     $acc2->setDepositAddress('mqUy9FUwaPjXZjYyW3UjsTpYMHdckq6kin');
     $acc2->setReferrer($acc1);
     $manager->persist($acc2);
     $acc3 = new Account();
     $acc3->setWithdrawAddress('mxMEGiP93LEAXwgx548HizWTxc5jr42bgq');
     $acc3->setDepositAddress('n4avMwZWyqXbNgxxtfmdMSu1nQfhLcWPR9');
     $acc3->setReferrer($acc1);
     $manager->persist($acc3);
     $acc4 = new Account();
     $acc4->setWithdrawAddress('n13WFTuHsaeC4kFotfu5v9E6GcUbnkT5Po');
     $acc4->setDepositAddress('mqqcH6zWoKs8UcuY3ZfwANYxFqBiRJWL9F');
     $acc4->setReferrer($acc2);
     $manager->persist($acc4);
     $manager->flush();
 }
Example #2
0
 /**
  * @Route("/{round}/register", name="register", requirements={"round": "\d+"})
  * @Template()
  */
 public function registerAction(Request $request, $round = null)
 {
     $round = $round ? $this->roundRepo->find($round) : $this->roundRepo->findCurrent();
     $address = $request->get('address', null);
     if (!$address) {
         $this->getSession()->getFlashBag()->set('error', 'Address is required');
     } else {
         $validation = $this->manager->validateAddress($address);
         if (!$validation->isValid()) {
             $this->getSession()->getFlashBag()->set('error', 'Invalid address');
         } else {
             if (!($account = $this->accountRepo->findOneBy(['withdrawAddress' => $address]))) {
                 $depositAddress = $this->manager->getNewAddress($round->getWalletAccount());
                 $account = new Account();
                 $account->setWithdrawAddress($address);
                 $account->setDepositAddress($depositAddress);
                 if (($ref = $this->getSession()->get('ref')) || ($ref = $request->cookies->get('ref'))) {
                     if ($refAccount = $this->accountRepo->find($ref)) {
                         $account->setReferrer($refAccount);
                         $refAccount->addReferralRegistersCount();
                     }
                 }
                 $this->getDoctrine()->getManager()->persist($account);
                 $this->getDoctrine()->getManager()->flush();
             }
             $this->getSession()->set('account', $account->getId());
         }
     }
     return $this->redirect($this->generateUrl('stats', ['round' => $round->getId()]));
 }