diff options
author | Jérémy Benoist <j0k3r@users.noreply.github.com> | 2019-01-23 09:19:37 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-23 09:19:37 +0100 |
commit | c6024246b744e411175318065f7c396bbb5a213e (patch) | |
tree | 635cbb8cd75888990e90c52317db72068196291d /src/Wallabag/ApiBundle/Controller/EntryRestController.php | |
parent | a8f4f7665c98753cca15140c283d49e0aa4cd0ab (diff) | |
parent | 801042544444d58580d87d04d5602797027153fc (diff) | |
download | wallabag-c6024246b744e411175318065f7c396bbb5a213e.tar.gz wallabag-c6024246b744e411175318065f7c396bbb5a213e.tar.zst wallabag-c6024246b744e411175318065f7c396bbb5a213e.zip |
Merge pull request #3627 from craig0990/feature/add-search-api-endpoint2.4
Add a basic Search REST endpoint
Diffstat (limited to 'src/Wallabag/ApiBundle/Controller/EntryRestController.php')
-rw-r--r-- | src/Wallabag/ApiBundle/Controller/EntryRestController.php | 22 |
1 files changed, 1 insertions, 21 deletions
diff --git a/src/Wallabag/ApiBundle/Controller/EntryRestController.php b/src/Wallabag/ApiBundle/Controller/EntryRestController.php index f792aaf2..16d8a40b 100644 --- a/src/Wallabag/ApiBundle/Controller/EntryRestController.php +++ b/src/Wallabag/ApiBundle/Controller/EntryRestController.php | |||
@@ -4,14 +4,12 @@ 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 Symfony\Component\HttpFoundation\JsonResponse; | 8 | use Symfony\Component\HttpFoundation\JsonResponse; |
10 | use Symfony\Component\HttpFoundation\Request; | 9 | use Symfony\Component\HttpFoundation\Request; |
11 | use Symfony\Component\HttpFoundation\Response; | 10 | use Symfony\Component\HttpFoundation\Response; |
12 | use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; | 11 | use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; |
13 | use Symfony\Component\HttpKernel\Exception\HttpException; | 12 | use Symfony\Component\HttpKernel\Exception\HttpException; |
14 | use Symfony\Component\Routing\Generator\UrlGeneratorInterface; | ||
15 | use Wallabag\CoreBundle\Entity\Entry; | 13 | use Wallabag\CoreBundle\Entity\Entry; |
16 | use Wallabag\CoreBundle\Entity\Tag; | 14 | use Wallabag\CoreBundle\Entity\Tag; |
17 | use Wallabag\CoreBundle\Event\EntryDeletedEvent; | 15 | use Wallabag\CoreBundle\Event\EntryDeletedEvent; |
@@ -141,7 +139,7 @@ class EntryRestController extends WallabagRestController | |||
141 | 'tags' => $tags, | 139 | 'tags' => $tags, |
142 | 'since' => $since, | 140 | 'since' => $since, |
143 | ], | 141 | ], |
144 | UrlGeneratorInterface::ABSOLUTE_URL | 142 | true |
145 | ) | 143 | ) |
146 | ); | 144 | ); |
147 | 145 | ||
@@ -774,24 +772,6 @@ class EntryRestController extends WallabagRestController | |||
774 | } | 772 | } |
775 | 773 | ||
776 | /** | 774 | /** |
777 | * Shortcut to send data serialized in json. | ||
778 | * | ||
779 | * @param mixed $data | ||
780 | * | ||
781 | * @return JsonResponse | ||
782 | */ | ||
783 | private function sendResponse($data) | ||
784 | { | ||
785 | // https://github.com/schmittjoh/JMSSerializerBundle/issues/293 | ||
786 | $context = new SerializationContext(); | ||
787 | $context->setSerializeNull(true); | ||
788 | |||
789 | $json = $this->get('jms_serializer')->serialize($data, 'json', $context); | ||
790 | |||
791 | return (new JsonResponse())->setJson($json); | ||
792 | } | ||
793 | |||
794 | /** | ||
795 | * Retrieve value from the request. | 775 | * Retrieve value from the request. |
796 | * Used for POST & PATCH on a an entry. | 776 | * Used for POST & PATCH on a an entry. |
797 | * | 777 | * |