diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2018-10-24 20:11:45 +0200 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2019-01-22 20:42:25 +0100 |
commit | 019e1acc4962229a538421b6f2b0643d03c1d72c (patch) | |
tree | 2d7cb5a5a1908e4db4b17c1cfe405d437928a469 /src/Wallabag/ApiBundle/Controller/EntryRestController.php | |
parent | 9133bd02d11c37c98b2c7c979e363cc7bff8f914 (diff) | |
download | wallabag-019e1acc4962229a538421b6f2b0643d03c1d72c.tar.gz wallabag-019e1acc4962229a538421b6f2b0643d03c1d72c.tar.zst wallabag-019e1acc4962229a538421b6f2b0643d03c1d72c.zip |
Factorize sendResponse between Api controllers
And run newer cs fixer
Diffstat (limited to 'src/Wallabag/ApiBundle/Controller/EntryRestController.php')
-rw-r--r-- | src/Wallabag/ApiBundle/Controller/EntryRestController.php | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/src/Wallabag/ApiBundle/Controller/EntryRestController.php b/src/Wallabag/ApiBundle/Controller/EntryRestController.php index f792aaf2..a79e852c 100644 --- a/src/Wallabag/ApiBundle/Controller/EntryRestController.php +++ b/src/Wallabag/ApiBundle/Controller/EntryRestController.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 Symfony\Component\HttpFoundation\JsonResponse; | 8 | use Symfony\Component\HttpFoundation\JsonResponse; |
10 | use Symfony\Component\HttpFoundation\Request; | 9 | use Symfony\Component\HttpFoundation\Request; |
@@ -774,24 +773,6 @@ class EntryRestController extends WallabagRestController | |||
774 | } | 773 | } |
775 | 774 | ||
776 | /** | 775 | /** |
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. | 776 | * Retrieve value from the request. |
796 | * Used for POST & PATCH on a an entry. | 777 | * Used for POST & PATCH on a an entry. |
797 | * | 778 | * |