]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/ApiBundle/Controller/SearchRestController.php
Factorize sendResponse between Api controllers
[github/wallabag/wallabag.git] / src / Wallabag / ApiBundle / Controller / SearchRestController.php
index 6620107d36e76d8f774065c61b5515057cdeb412..f8da0ad4a28a179512199a5bd8d5183d84266b88 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 Pagerfanta\Adapter\DoctrineORMAdapter;
 use Pagerfanta\Pagerfanta;
@@ -64,22 +63,4 @@ class SearchRestController extends WallabagRestController
 
         return $this->sendResponse($paginatedCollection);
     }
-
-    /**
-     * 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);
-    }
 }