src/Sulu/Bundle/ContactBundle/Controller/ContactController.php
public function postAction(Request $request)
    {
        try {
            $this->checkArguments($request);
            $contact = $this->getContactManager()->save(
                $request->request->all()
            );
            $apiContact = $this->getContactManager()->getContact(
                $contact,
                $this->getLocale($request)
            );
            $view = $this->view($apiContact, 200);
            $context = new Context();
            $context->setGroups(static::$contactSerializationGroups);
            $view->setContext($context);
        } catch (EntityNotFoundException $enfe) {
            $view = $this->view($enfe->toArray(), 404);
        } catch (MissingArgumentException $maex) {
            $view = $this->view($maex->toArray(), 400);
        } catch (RestException $re) {
            $view = $this->view($re->toArray(), 400);
        }

        return $this->handleView($view);
    }
public function postAction(Request $request)
    {
        try {
            $this->checkArguments($request);
            $contact = $this->getContactManager()->save(
                $request->request->all()
            );
            $apiContact = $this->getContactManager()->getContact(
                $contact,
                $this->getLocale($request)
            );
            $view = $this->view($apiContact, 200);
            $context = new Context();
            $context->setGroups(static::$contactSerializationGroups);
            $view->setContext($context);
        } catch (EntityNotFoundException $enfe) {
            $view = $this->view($enfe->toArray(), 404);
        } catch (MissingArgumentException $maex) {
            $view = $this->view($maex->toArray(), 400);
        } catch (RestException $re) {
            $view = $this->view($re->toArray(), 400);
        }

        return $this->handleView($view);
    }
public function postAction ( Request $ request ) { try { $ this -> checkArguments ( $ request ) ; $ contact = $ this -> getContactManager ( ) -> save ( $ request -> request -> all ( ) ) ; $ apiContact = $ this -> getContactManager ( ) -> getContact ( $ contact , $ this -> getLocale ( $ request ) ) ; $ view = $ this -> view ( $ apiContact , 200 ) ; $ context = new Context ( ) ; $ context -> setGroups ( static :: $ contactSerializationGroups ) ; $ view -> setContext ( $ context ) ; } catch ( EntityNotFoundException $ enfe ) { $ view = $ this -> view ( $ enfe -> toArray ( ) , 404 ) ; } catch ( MissingArgumentException $ maex ) { $ view = $ this -> view ( $ maex -> toArray ( ) , 400 ) ; } catch ( RestException $ re ) { $ view = $ this -> view ( $ re -> toArray ( ) , 400 ) ; } return $ this -> handleView ( $ view ) ; }
Creates a new contact.

@param Request $request

@return \Symfony\Component\HttpFoundation\Response
Creates a new contact .