Enable @Rest\View annotations.
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Wed, 27 Jun 2018 20:21:31 +0000 (22:21 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Wed, 27 Jun 2018 20:21:31 +0000 (22:21 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
config/config.yaml
src/Controller/PersonController.php

index 3c4eb73c1a66088663c5fd68fb75b6c20a0b4d0b..d0d7baf956579f6dbe742623c8cf704f39a1cb0c 100644 (file)
@@ -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<version>[0-9\.]+)/'
 
 sensio_framework_extra:
-    view: { annotations: false }
     request: { converters: true }
index 6ee3fdfc52ba561a8c42e872b1820e9abf35ed57..806d2124f970c745192e3396e0d2cdd971591735 100644 (file)
@@ -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);