Controller/ArticleController.php
public function postAction(Request $request)
    {
        $action = $request->get('action');
        $document = $this->getDocumentManager()->create(self::DOCUMENT_TYPE);
        $locale = $this->getRequestParameter($request, 'locale', true);
        $data = $request->request->all();

        $this->persistDocument($data, $document, $locale);
        $this->handleActionParameter($action, $document, $locale);
        $this->getDocumentManager()->flush();

        return $this->handleView(
            $this->view($document)->setSerializationContext(
                SerializationContext::create()
                    ->setSerializeNull(true)
                    ->setGroups(['defaultPage', 'defaultArticle', 'smallArticlePage'])
            )
        );
    }
public function postAction(Request $request)
    {
        $action = $request->get('action');
        $document = $this->getDocumentManager()->create(self::DOCUMENT_TYPE);
        $locale = $this->getRequestParameter($request, 'locale', true);
        $data = $request->request->all();

        $this->persistDocument($data, $document, $locale);
        $this->handleActionParameter($action, $document, $locale);
        $this->getDocumentManager()->flush();

        return $this->handleView(
            $this->view($document)->setSerializationContext(
                SerializationContext::create()
                    ->setSerializeNull(true)
                    ->setGroups(['defaultPage', 'defaultArticle', 'smallArticlePage'])
            )
        );
    }
public function postAction ( Request $ request ) { $ action = $ request -> get ( 'action' ) ; $ document = $ this -> getDocumentManager ( ) -> create ( self :: DOCUMENT_TYPE ) ; $ locale = $ this -> getRequestParameter ( $ request , 'locale' , true ) ; $ data = $ request -> request -> all ( ) ; $ this -> persistDocument ( $ data , $ document , $ locale ) ; $ this -> handleActionParameter ( $ action , $ document , $ locale ) ; $ this -> getDocumentManager ( ) -> flush ( ) ; return $ this -> handleView ( $ this -> view ( $ document ) -> setSerializationContext ( SerializationContext :: create ( ) -> setSerializeNull ( true ) -> setGroups ( [ 'defaultPage' , 'defaultArticle' , 'smallArticlePage' ] ) ) ) ; }
Create article.

@param Request $request

@return Response
Create article .