X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FApiBundle%2FController%2FUserRestController.php;h=922ab7bbb261eb7dd026e6ca2ed1fceaccfb1d00;hb=8668796106b856ca041512af27268ce6e49d2caf;hp=6f47cff0dd85a8ddb759ef906c27f146ceffc01a;hpb=f808b01692a835673f328d7221ba8c212caa9b61;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/ApiBundle/Controller/UserRestController.php b/src/Wallabag/ApiBundle/Controller/UserRestController.php index 6f47cff0..922ab7bb 100644 --- a/src/Wallabag/ApiBundle/Controller/UserRestController.php +++ b/src/Wallabag/ApiBundle/Controller/UserRestController.php @@ -45,8 +45,8 @@ class UserRestController extends WallabagRestController */ public function putUserAction(Request $request) { - if (!$this->getParameter('fosuser_registration') || !$this->get('craue_config')->get('api_user_registration')) { - $json = $this->get('serializer')->serialize(['error' => "Server doesn't allow registrations"], 'json'); + if (!$this->container->getParameter('fosuser_registration') || !$this->get('craue_config')->get('api_user_registration')) { + $json = $this->get('jms_serializer')->serialize(['error' => "Server doesn't allow registrations"], 'json'); return (new JsonResponse()) ->setJson($json) @@ -77,7 +77,7 @@ class UserRestController extends WallabagRestController $view->setFormat('json'); // handle errors in a more beautiful way than the default view - $data = json_decode($this->handleView($view)->getContent(), true)['children']; + $data = json_decode($this->handleView($view)->getContent(), true)['errors']['children']; $errors = []; if (isset($data['username']['errors'])) { @@ -92,7 +92,7 @@ class UserRestController extends WallabagRestController $errors['password'] = $this->translateErrors($data['plainPassword']['children']['first']['errors']); } - $json = $this->get('serializer')->serialize(['error' => $errors], 'json'); + $json = $this->get('jms_serializer')->serialize(['error' => $errors], 'json'); return (new JsonResponse()) ->setJson($json) @@ -119,7 +119,6 @@ class UserRestController extends WallabagRestController /** * Send user response. * - * @param User $user * @param string $group Used to define with serialized group might be used * @param int $status HTTP Status code to send * @@ -127,7 +126,7 @@ class UserRestController extends WallabagRestController */ private function sendUser(User $user, $group = 'user_api', $status = JsonResponse::HTTP_OK) { - $json = $this->get('serializer')->serialize( + $json = $this->get('jms_serializer')->serialize( $user, 'json', SerializationContext::create()->setGroups([$group])