forked from wallabag/wallabag
Added serialization group
This commit is contained in:
committed by
Jeremy Benoist
parent
bb12538fab
commit
aaa03cc395
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user