diff options
Diffstat (limited to 'src/Wallabag/ApiBundle/Controller/SearchRestController.php')
-rw-r--r-- | src/Wallabag/ApiBundle/Controller/SearchRestController.php | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/src/Wallabag/ApiBundle/Controller/SearchRestController.php b/src/Wallabag/ApiBundle/Controller/SearchRestController.php index 6620107d..f8da0ad4 100644 --- a/src/Wallabag/ApiBundle/Controller/SearchRestController.php +++ b/src/Wallabag/ApiBundle/Controller/SearchRestController.php | |||
@@ -4,7 +4,6 @@ namespace Wallabag\ApiBundle\Controller; | |||
4 | 4 | ||
5 | use Hateoas\Configuration\Route; | 5 | use Hateoas\Configuration\Route; |
6 | use Hateoas\Representation\Factory\PagerfantaFactory; | 6 | use Hateoas\Representation\Factory\PagerfantaFactory; |
7 | use JMS\Serializer\SerializationContext; | ||
8 | use Nelmio\ApiDocBundle\Annotation\ApiDoc; | 7 | use Nelmio\ApiDocBundle\Annotation\ApiDoc; |
9 | use Pagerfanta\Adapter\DoctrineORMAdapter; | 8 | use Pagerfanta\Adapter\DoctrineORMAdapter; |
10 | use Pagerfanta\Pagerfanta; | 9 | use Pagerfanta\Pagerfanta; |
@@ -64,22 +63,4 @@ class SearchRestController extends WallabagRestController | |||
64 | 63 | ||
65 | return $this->sendResponse($paginatedCollection); | 64 | return $this->sendResponse($paginatedCollection); |
66 | } | 65 | } |
67 | |||
68 | /** | ||
69 | * Shortcut to send data serialized in json. | ||
70 | * | ||
71 | * @param mixed $data | ||
72 | * | ||
73 | * @return JsonResponse | ||
74 | */ | ||
75 | private function sendResponse($data) | ||
76 | { | ||
77 | // https://github.com/schmittjoh/JMSSerializerBundle/issues/293 | ||
78 | $context = new SerializationContext(); | ||
79 | $context->setSerializeNull(true); | ||
80 | |||
81 | $json = $this->get('jms_serializer')->serialize($data, 'json', $context); | ||
82 | |||
83 | return (new JsonResponse())->setJson($json); | ||
84 | } | ||
85 | } | 66 | } |