/**
  * @return array
  */
 public function serialize()
 {
     $parentData = parent::serialize();
     if ($this->userPromotion === null) {
         throw new NotEnoughDataException('userPromotion is null');
     }
     if ($this->userPromotion->getId() === null) {
         throw new NotEnoughDataException('userPromotion->id is null');
     }
     $parentData['id'] = $this->userPromotion->getId();
     return $parentData;
 }
 /**
  * @return array
  */
 public function serialize()
 {
     $parentData = parent::serialize();
     if ($this->promotion === null) {
         throw new NotEnoughDataException('promotion is null');
     }
     if ($this->promotion->getAlias() === null) {
         throw new NotEnoughDataException('promotion->alias is null');
     }
     if ($this->user === null) {
         throw new NotEnoughDataException('user is null');
     }
     if ($this->user->getId() === null) {
         throw new NotEnoughDataException('user->id is null');
     }
     $parentData['promotion_alias'] = $this->promotion->getAlias();
     $parentData['user_id'] = $this->user->getId();
     return $parentData;
 }
Пример #3
0
 /**
  * {@inheritdoc}
  */
 public function registerSale(Sale $sale)
 {
     $data = $sale->serialize();
     $response = $this->prepareRequest(Http::POST, $this->getUrl(self::SALE))->body($data, 'application/json')->send();
     $this->getSuccessData($response);
     return true;
 }