public function testSetZone()
 {
     $zone = new Zone();
     $zone->setId(self::MOCK_ZONE_ID);
     $this->updater->setZone($zone);
     $this->assertAttributeEquals($zone, 'zone', $this->updater);
 }
 private function getReference($banner)
 {
     $ref = $banner->getReferenceInZone($this->zone->getId());
     if (null === $ref) {
         $ref = $this->createNewReference($banner);
     }
     return $ref;
 }
 public function getBannerPaymentOrderNumber(Banner $banner, Advertiser $advertiser, Zone $zone = null)
 {
     $items = array();
     $items[] = self::PREFIX_BANNER . $banner->getId();
     $items[] = $advertiser->getId();
     if (null !== $zone) {
         $items[] = $zone->getId();
     }
     $items[] = (int) mt_rand(0, 1000);
     return implode('-', $items);
 }
Esempio n. 4
0
 /**
  * @param Zone $zone
  * @return Order[]
  */
 public function getOrdersInZone(Zone $zone)
 {
     $ordersInZone = array();
     foreach ($this->orders as $order) {
         /** @var $order Order */
         /** @var $orderZone Zone */
         $reference = $order->getBannerZoneReference();
         if (!empty($reference)) {
             $orderZone = $reference->getZone();
             if (!empty($orderZone) && $orderZone->getId() == $zone->getId()) {
                 $ordersInZone[] = $order;
             }
         }
     }
     return $ordersInZone;
 }
 public function getDayPriceForZone(Zone $zone)
 {
     /** @var $zoneRepository \Hyper\AdsBundle\Entity\ZoneRepository */
     $zoneRepository = $this->entityManager->getRepository('HyperAdsBundle:Zone');
     return $this->getCompoundPrice($zone->getDailyPrice(), $zoneRepository->getCurrentNumberOfActiveBannersInZone($zone));
 }