Exemplo n.º 1
0
 /**
  * @param \Hyper\AdsBundle\Entity\Banner $banner
  *
  * @return \Hyper\AdsBundle\Entity\BannerZoneReference
  */
 private function createNewReference(Banner $banner)
 {
     $ref = new BannerZoneReference();
     $ref->setBanner($banner);
     $ref->setZone($this->zone);
     return $ref;
 }
 private function addReferenceAndOrder(Banner $banner, Zone $zone)
 {
     /** @var $orderNumberGenerator \Hyper\AdsBundle\Helper\OrderNumberGenerator */
     $orderNumberGenerator = $this->get('hyper_ads.order_number_generator');
     $em = $this->getDoctrine()->getManager();
     $ref = new BannerZoneReference();
     $ref->setZone($zone);
     $ref->setBanner($banner);
     $ref->setProbability(1);
     $ref->setPayModel(PayModelType::PAY_MODEL_DAILY);
     $order = new Order();
     $order->setOrderNumber($orderNumberGenerator->getBannerPaymentOrderNumber($banner, $this->getUser(), $zone));
     $order->setAnnouncement($banner);
     $order->setBannerZoneReference($ref);
     $em->persist($ref);
     $em->persist($order);
 }