/**
  * @Route("/customer/{id}/show" , name="donate_admin_reporting_customer_show", defaults={"id" = 0})
  */
 public function customerShowAction(Request $request, Customer $customer)
 {
     $entityMgr = $this->getDoctrine()->getManager();
     $intentsQuery = $entityMgr->getRepository('DonateCoreBundle:Intent')->getIntentsListByCustomer(['customerId' => $customer->getId()]);
     $pagination = $this->getPagination($request, $intentsQuery, 10);
     return $this->render('DonateAdminBundle:Reporting:customerShow.html.twig', ['customer' => $customer, 'pagination' => $pagination]);
 }
Beispiel #2
0
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     ini_set('memory_limit', '2048M');
     for ($i = 1; $i <= 6000; $i++) {
         $customer = new Customer();
         $customer->setCreatedAt(self::getRandomDate());
         $customer->setFirstName(self::getRandomFirstname());
         $customer->setLastName(self::getRandomLastname());
         $customer->setCivility(self::getRandomCivility());
         $customer->setEmail(self::getRandomEmail($customer->getLastName()));
         $customer->setAddressStreet(self::getRandomAddressStreet());
         $customer->setBirthday(self::getRandomDate());
         $customer->setPhone(self::getRandomPhone());
         $customer->setCompany(self::getRandomCompany());
         $customer->setRemoteId(self::getRandomRemoteId());
         $customer->setWebsite(self::getRandomWebsite());
         $customer->setAddressZipcode(self::getRandomZipCode());
         $customer->setAddressCity(self::getRandomCity());
         $customer->setAddressCountry(self::getRandomCountry());
         $CustomerOgoneID = $customer->getLastName() . '_OGONE_' . self::getRandomRemoteId();
         $manager->persist($customer);
         $jmax = rand(1, 3);
         $j = 1;
         if ($i % 1000 == 0) {
             $manager->flush();
         }
         for ($j = 1; $j <= $jmax; $j++) {
             $amount = self::getRandomAmount();
             $paymentMethod = self::getRandomPaymentMethod();
             $campaign = self::getRandomCampaign();
             $intent = new Intent($amount, $paymentMethod, 'EUR', $campaign);
             $intent->setCustomer($customer);
             $intent->setCreatedAt(self::getRandomDate());
             $intent->setType(self::getRandomType());
             $intent->setStatus(self::getRandomStatus());
             $intent->setFiscalReceipt(self::getRandomFiscalReceipt());
             $manager->persist($intent);
             $pmax = 1;
             if ($intent->getType() == Intent::TYPE_RECURING) {
                 $pmax = rand(1, 15);
             }
             for ($p = 1; $p <= $pmax; $p++) {
                 $payment = new Payment();
                 $payment->setIntent($intent);
                 if ($pmax == 1 && $p == $pmax) {
                     $payment->setStatus(self::getRandomPaymentStatus());
                 } else {
                     $payment->setStatus(Payment::STATUS_PAYED);
                 }
                 $payment->setAlias($CustomerOgoneID);
                 $payment->setTransaction(self::getRandomTransactionId());
                 $payment->setAutorisation(self::getRandomAutorisationId());
                 $manager->persist($payment);
             }
         }
     }
     $manager->flush();
 }