Esempio n. 1
0
 /**
  * Transforms the given collection.
  *
  * @param mixed $collection
  * @param string|Transformer $transformer
  * @param null|string $resourceKey
  * @return Collection
  */
 public function collection($collection, $transformer, $resourceKey = null)
 {
     if (!$transformer instanceof TransformerAbstract) {
         $transformer = $this->getTransformer($transformer);
     }
     $resourceKey = $transformer->resourceKey();
     return parent::collection($collection, $transformer, $resourceKey);
 }
Esempio n. 2
0
 /**
  * @inheritDoc
  */
 protected function collection($data, $transformer, $resourceKey = null)
 {
     /* @var BaseTransformer $transformer */
     // TODO: check if there is a necessity to only return null if a transformer is marked included
     if (is_null($data)) {
         return null;
     }
     return parent::collection($data, $transformer, $resourceKey);
 }