public function putAction($id, Request $request)
{
try {
/** @var AccountInterface $account */
$account = $this->getDoctrine()->getRepository($this->getAccountEntityName())->findAccountById($id);
if (!$account) {
throw new EntityNotFoundException($this->getAccountEntityName(), $id);
} else {
$em = $this->getDoctrine()->getManager();
$this->doPut($account, $request);
$em->flush();
// get api entity
$accountManager = $this->getAccountManager();
$locale = $this->getUser()->getLocale();
$acc = $accountManager->getAccount($account, $locale);
$view = $this->view($acc, 200);
$view->setSerializationContext(SerializationContext::create()->setGroups(self::$accountSerializationGroups));
}
} catch (EntityNotFoundException $enfe) {
$view = $this->view($enfe->toArray(), 404);
} catch (RestException $exc) {
$view = $this->view($exc->toArray(), 400);
}
return $this->handleView($view);
}