/**
  * @return ProductStatistics
  */
 public function setDataToObject()
 {
     $this->object->setCalculatedViews($this->getFormattedData('calculatedViews', 'integer'));
     $this->object->setCalculatedUniqueViews($this->getFormattedData('calculatedUniqueViews', 'integer'));
     $this->object->setCalculatedOrders($this->getFormattedData('calculatedOrders', 'integer'));
     $this->object->setCalculatedUniqueOrders($this->getFormattedData('calculatedUniqueOrders', 'integer'));
     $this->object->setCalculatedConversion($this->getFormattedData('calculatedConversion', 'integer'));
     $this->object->setCalculatedTotal($this->getFormattedData('calculatedTotal', 'integer'));
     $this->object->setCalculatedScore($this->getFormattedData('calculatedScore', 'integer'));
     $this->object->setIsCheat($this->getFormattedData('isCheat', 'integer'));
     parent::setDataToObject();
 }
 /**
  * @return Product
  */
 public function setDataToObject()
 {
     $this->statisticsObject = null;
     $objects = $this->object->getProductStatistics();
     if ($objects->count()) {
         foreach ($objects->toArray() as $object) {
             if ($object->getTimeKey() == $this->timeKey) {
                 $this->statisticsObject = $object;
             }
         }
     }
     if (!$this->statisticsObject) {
         $this->statisticsObject = new ProductStatistics();
     }
     $this->statisticsObject->setTimeKey($this->timeKey);
     $this->statisticsObject->setViews($this->getFormattedData('views', 'integer'));
     $this->statisticsObject->setUniqueViews($this->getFormattedData('uniqueViews', 'integer'));
     $this->statisticsObject->setProduct($this->object);
     $this->entityManager->persist($this->statisticsObject);
     parent::setDataToObject();
 }
예제 #3
0
 /**
  * @param ProductStatistics $statistics
  * @return int
  */
 protected function getTotal(ProductStatistics $statistics)
 {
     return $statistics->getCalculatedTotal();
 }
 /**
  * @param ProductStatistics $productStatistics
  * @return int
  */
 protected function getUniqueViews(ProductStatistics $productStatistics)
 {
     return $productStatistics->getUniqueViews();
 }