Пример #1
0
 /**
  * @inheritdoc
  */
 public function getJson()
 {
     $serializer = new NostoProductCollectionSerializerJson();
     return $serializer->serialize($this);
 }
Пример #2
0
 /**
  * Returns the whole collection in JSON format.
  *
  * @return string the json.
  * @throws NostoException if the collection is empty.
  */
 protected function getCollectionAsJson()
 {
     if ($this->collection->count() === 0) {
         throw new NostoException('No products found in collection.');
     }
     $serializer = new NostoProductCollectionSerializerJson();
     return $serializer->serialize($this->collection);
 }