1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-07-22 17:18:37 +00:00

Added serialization group

This commit is contained in:
Nicolas Lœuillet 2022-03-15 10:44:32 +01:00 committed by Jeremy Benoist
parent bb12538fab
commit aaa03cc395
No known key found for this signature in database
GPG key ID: BCA73962457ACC3C
4 changed files with 32 additions and 3 deletions

View file

@ -2,6 +2,7 @@
namespace Wallabag\ApiBundle\Controller;
use JMS\Serializer\SerializationContext;
use Nelmio\ApiDocBundle\Annotation\ApiDoc;
use Symfony\Component\HttpFoundation\JsonResponse;
@ -18,6 +19,14 @@ class ConfigRestController extends WallabagRestController
{
$this->validateAuthentication();
return $this->sendResponse($this->getUser()->getConfig());
$json = $this->get('jms_serializer')->serialize(
$this->getUser()->getConfig(),
'json',
SerializationContext::create()->setGroups(['config_api'])
);
return (new JsonResponse())
->setJson($json)
->setStatusCode(JsonResponse::HTTP_OK);
}
}