Ejemplo n.º 1
0
 public function getAction($id)
 {
     $entity = $this->repository->find($id);
     if (!$entity) {
         return new Response($this->serializer->serialize(ResponseMeta::error(sprintf('object %s not found.', $id)), $this->request->getRequestFormat()), Response::HTTP_NOT_FOUND);
     }
     return new Response($this->serializer->serialize(ResponseMeta::success($entity), $this->request->getRequestFormat(), ['groups' => ['single']]));
 }
Ejemplo n.º 2
0
 public function companyListAction($id)
 {
     $entity = $this->repository->find($id);
     if (!$entity) {
         return new Response($this->serializer->serialize(ResponseMeta::error(sprintf('object %s not found.', $id)), $this->request->getRequestFormat()), Response::HTTP_NOT_FOUND);
     }
     $entities = $this->repository->getCompanyList($entity, $this->request->limit(), $this->request->offset());
     return new Response($this->serializer->serialize(ResponseMeta::success($entities), $this->request->getRequestFormat(), ['groups' => ['list']]));
 }
Ejemplo n.º 3
0
 public function listAction()
 {
     $entities = $this->repository->findBy([], [], $this->request->limit(), $this->request->offset());
     return new Response($this->serializer->serialize(ResponseMeta::success($entities), $this->request->getRequestFormat(), ['groups' => ['list']]));
 }