X-Git-Url: https://git.piment-noir.org/?p=Project_proches_de_moi-server.git;a=blobdiff_plain;f=src%2FController%2FPersonController.php;fp=src%2FController%2FPersonController.php;h=102b6980245824c6ca33201fe66ae29d641a3573;hp=0fb898527414e14ff7c940e3744cd8ea7f2c1edb;hb=0a86529e66b5c3a97ed60dd8451129350a42829c;hpb=0ec62082a8e067a4a9d00ac728ec00d4da10777d diff --git a/src/Controller/PersonController.php b/src/Controller/PersonController.php index 0fb8985..102b698 100644 --- a/src/Controller/PersonController.php +++ b/src/Controller/PersonController.php @@ -200,6 +200,31 @@ class PersonController extends Controller return $viewHandler->handle($view); } + /** + * @Rest\Get( + * path = "/api/persons", + * name = "show_persons" + * ) + * @Rest\View() + */ + public function showPersons(Request $request) + { + $em = $this->getDoctrine()->getManager(); + $persons = $em->getRepository('App:Person')->findAll(); + + $viewHandler = $this->get('fos_rest.view_handler'); + + if (empty($persons)) { + return $this->PersonNotFound($viewHandler); + } + + // $view = View::create($persons); + // $view->setFormat('json'); + // + // return $viewHandler->handle($view); + return $persons; + } + /** * @Rest\Get( * path = "/api/person/{email}/friends",