]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/ApiBundle/Controller/EntryRestController.php
Factorize sendResponse between Api controllers
[github/wallabag/wallabag.git] / src / Wallabag / ApiBundle / Controller / EntryRestController.php
index f792aaf23a6afd53b6a3a498e992858fb73da1c1..a79e852cb0d833a3d00f522a0c037592ebb356c5 100644 (file)
@@ -4,7 +4,6 @@ namespace Wallabag\ApiBundle\Controller;
 
 use Hateoas\Configuration\Route;
 use Hateoas\Representation\Factory\PagerfantaFactory;
-use JMS\Serializer\SerializationContext;
 use Nelmio\ApiDocBundle\Annotation\ApiDoc;
 use Symfony\Component\HttpFoundation\JsonResponse;
 use Symfony\Component\HttpFoundation\Request;
@@ -773,24 +772,6 @@ class EntryRestController extends WallabagRestController
         return $this->sendResponse($results);
     }
 
-    /**
-     * Shortcut to send data serialized in json.
-     *
-     * @param mixed $data
-     *
-     * @return JsonResponse
-     */
-    private function sendResponse($data)
-    {
-        // https://github.com/schmittjoh/JMSSerializerBundle/issues/293
-        $context = new SerializationContext();
-        $context->setSerializeNull(true);
-
-        $json = $this->get('jms_serializer')->serialize($data, 'json', $context);
-
-        return (new JsonResponse())->setJson($json);
-    }
-
     /**
      * Retrieve value from the request.
      * Used for POST & PATCH on a an entry.