Sulu\Bundle\ContactBundle\Controller\AccountController::putAction PHP Метод

putAction() публичный Метод

Edits the existing contact with the given id.
public putAction ( integer $id, Request $request ) : Response
$id integer The id of the contact to update
$request Symfony\Component\HttpFoundation\Request
Результат Symfony\Component\HttpFoundation\Response
    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);
    }