示例#1
0
 /**
  * @param $items
  * @param int $statusCode
  * @return ApiResponse
  */
 public function collection($items, $statusCode = Response::HTTP_OK)
 {
     if ($this->transformer) {
         $items = $this->transformer->transformCollection($items);
     }
     return $this->header('Content-Type', 'application/json')->setContent($this->encode($items))->setStatusCode($statusCode);
 }
 /**
  * @param TransformerInterface $transformer
  * @return mixed
  */
 public function transform(TransformerInterface $transformer)
 {
     return ['message' => 'There was an issue with the validation of provided entity', 'invalid' => $transformer->transformCollection($this->getResponse())];
 }
示例#3
0
 /**
  * @param TransformerInterface $transformer
  * @return mixed
  */
 public function transform(TransformerInterface $transformer)
 {
     return $transformer->transformItem($this->getResponse());
 }