Enable @Rest\View annotations.
authorJérôme Benoit <jerome.benoit@grenouille.com>
Wed, 27 Jun 2018 20:17:18 +0000 (22:17 +0200)
committerJérôme Benoit <jerome.benoit@grenouille.com>
Wed, 27 Jun 2018 20:17:18 +0000 (22:17 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@grenouille.com>
src/Controller/PersonController.php

index af3c28a95e4ced170dac009a82e1826aa81fc01e..6ee3fdfc52ba561a8c42e872b1820e9abf35ed57 100644 (file)
@@ -98,17 +98,17 @@ class PersonController extends FOSRestController
     }
 
     /**
+    * @Rest\View()
     * @Rest\Get(
     *     path = "/api/person/{id}",
     *     name = "show_person",
     *     requirements = {"id"="\d+"}
     * )
-    * @Rest\View()
     */
    public function showPerson(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);
@@ -148,7 +148,7 @@ class PersonController extends FOSRestController
   public function showPersonFriends(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);