Ejemplo n.º 1
0
 /**
  * Serializes the order collection into JSON.
  *
  * @param NostoOrderCollection $collection the collection to serialize.
  * @return string the JSON.
  */
 public function serialize(NostoOrderCollection $collection)
 {
     $data = array();
     $productSerializer = new NostoOrderSerializerArray();
     foreach ($collection->getArrayCopy() as $order) {
         $data[] = $productSerializer->serialize($order);
     }
     return json_encode($data);
 }
Ejemplo n.º 2
0
 /**
  * Serializes the order into an json structure.
  *
  * @param NostoOrderInterface $order the order to serialize.
  * @return string the serialized data.
  */
 public function serialize(NostoOrderInterface $order)
 {
     $serializer = new NostoOrderSerializerArray();
     return json_encode($serializer->serialize($order));
 }