public function toJsonObjectResponse($object, $merge = false) { if ($this->cache === true) { return $this->getCache(get_class($object), function () use($object, $merge) { $objectBuilder = new ObjectResponse($this->transformer, $object, $merge); if ($this->getCast() !== false) { $objectBuilder->setCast($this->getCast()); } return $objectBuilder->response(); }); } $objectBuilder = new ObjectResponse($this->transformer, $object, $merge); if ($this->getCast() !== false) { $objectBuilder->setCast($this->getCast()); } return $objectBuilder->response(); }
public function response() { if ($this->request->getPagination() === true) { $this->responseBody->put(Mapper::ATTR_LINKS, $this->getLinks()); $this->responseBody->put(Mapper::ATTR_META, $this->getMetaLinks()); } else { $this->responseBody->pull(Mapper::ATTR_LINKS); $this->responseBody->pull(Mapper::ATTR_META); } return parent::response(); }