src/Sulu/Bundle/ContactBundle/Controller/AccountController.php
public function putAction($id, Request $request)
    {
        try {
            $account = $this->getRepository()->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);

                $context = new Context();
                $context->setGroups(self::$accountSerializationGroups);

                $view = $this->view($acc, 200);
                $view->setContext($context);
            }
        } catch (EntityNotFoundException $enfe) {
            $view = $this->view($enfe->toArray(), 404);
        } catch (RestException $exc) {
            $view = $this->view($exc->toArray(), 400);
        }

        return $this->handleView($view);
    }
public function putAction($id, Request $request)
    {
        try {
            $account = $this->getRepository()->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);

                $context = new Context();
                $context->setGroups(self::$accountSerializationGroups);

                $view = $this->view($acc, 200);
                $view->setContext($context);
            }
        } catch (EntityNotFoundException $enfe) {
            $view = $this->view($enfe->toArray(), 404);
        } catch (RestException $exc) {
            $view = $this->view($exc->toArray(), 400);
        }

        return $this->handleView($view);
    }
public function putAction ( $ id , Request $ request ) { try { $ account = $ this -> getRepository ( ) -> 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 ) ; $ context = new Context ( ) ; $ context -> setGroups ( self :: $ accountSerializationGroups ) ; $ view = $ this -> view ( $ acc , 200 ) ; $ view -> setContext ( $ context ) ; } } catch ( EntityNotFoundException $ enfe ) { $ view = $ this -> view ( $ enfe -> toArray ( ) , 404 ) ; } catch ( RestException $ exc ) { $ view = $ this -> view ( $ exc -> toArray ( ) , 400 ) ; } return $ this -> handleView ( $ view ) ; }
Edits the existing contact with the given id.

@param int $id The id of the contact to update
@param Request $request

@return Response

@throws \Sulu\Component\Rest\Exception\EntityNotFoundException
Edits the existing contact with the given id .