From: Jérôme Benoit Date: Wed, 27 Jun 2018 20:21:31 +0000 (+0200) Subject: Enable @Rest\View annotations. X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=282545e599d54ea03ce33bac6e9087d9bf29245a;p=Project_proches_de_moi-server.git Enable @Rest\View annotations. Signed-off-by: Jérôme Benoit --- diff --git a/config/config.yaml b/config/config.yaml index 3c4eb73..d0d7baf 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -16,8 +16,10 @@ fos_rest: serialize_null: true format_listener: rules: - - { path: '^/', priorities: ['json'], fallback_format: 'json' } + - { path: '^/api', priorities: ['json'], fallback_format: 'json' } param_fetcher_listener: force + routing_loader: + include_format: false versioning: enabled: true resolvers: @@ -26,5 +28,4 @@ fos_rest: regex: '/(v|version)=(?P[0-9\.]+)/' sensio_framework_extra: - view: { annotations: false } request: { converters: true } diff --git a/src/Controller/PersonController.php b/src/Controller/PersonController.php index 6ee3fdf..806d212 100644 --- a/src/Controller/PersonController.php +++ b/src/Controller/PersonController.php @@ -36,7 +36,7 @@ class PersonController extends FOSRestController public function removePersonAction(Request $request) { $em = $this->getDoctrine()->getManager(); - $person = $em->getRepository('App::Person')->find($request->get('id')); + $person = $em->getRepository('App:Person')->find($request->get('id')); if (!empty($person)) { $em->remove($person); @@ -55,7 +55,7 @@ class PersonController extends FOSRestController public function updatePersonAction(Request $request) { $em = $this->getDoctrine()->getManager(); - $person = $em->getRepository('App::Person')->find($request->get('id')); + $person = $em->getRepository('App:Person')->find($request->get('id')); if (empty($person)) { return new JsonResponse(['message' => 'Person not found'], Response::HTTP_NOT_FOUND); @@ -128,7 +128,7 @@ class PersonController extends FOSRestController public function showPersonByEmail(Request $request) { $em = $this->getDoctrine()->getManager(); - $person = $em->getRepository('App::Person')->find($request->get('email')); + $person = $em->getRepository('App:Person')->find($request->get('email')); if (empty($person)) { return new JsonResponse(['message' => 'Person not found'], Response::HTTP_NOT_FOUND); @@ -168,7 +168,7 @@ class PersonController extends FOSRestController public function showPersonFriendsByEmail(Request $request) { $em = $this->getDoctrine()->getManager(); - $person = $em->getRepository('App::Person')->find($request->get('email')); + $person = $em->getRepository('App:Person')->find($request->get('email')); if (empty($person)) { return new JsonResponse(['message' => 'Person not found'], Response::HTTP_NOT_FOUND);