Controller/ArticleController.php
private function persistDocument($data, $document, $locale)
    {
        $formType = $this->getMetadataFactory()->getMetadataForAlias('article')->getFormType();
        $form = $this->createForm(
            $formType,
            $document,
            [
                // disable csrf protection, since we can't produce a token, because the form is cached on the client
                'csrf_protection' => false,
            ]
        );
        $form->submit($data, false);

        if (!$form->isValid()) {
            throw new InvalidFormException($form);
        }

        if (array_key_exists('author', $data) && null === $data['author']) {
            $document->setAuthor(null);
        }

        if (array_key_exists('additionalWebspaces', $data) && null === $data['additionalWebspaces']) {
            $document->setAdditionalWebspaces(null);
        }

        $this->getDocumentManager()->persist(
            $document,
            $locale,
            [
                'user' => $this->getUser()->getId(),
                'clear_missing_content' => false,
            ]
        );
    }
private function persistDocument($data, $document, $locale)
    {
        $formType = $this->getMetadataFactory()->getMetadataForAlias('article')->getFormType();
        $form = $this->createForm(
            $formType,
            $document,
            [
                // disable csrf protection, since we can't produce a token, because the form is cached on the client
                'csrf_protection' => false,
            ]
        );
        $form->submit($data, false);

        if (!$form->isValid()) {
            throw new InvalidFormException($form);
        }

        if (array_key_exists('author', $data) && null === $data['author']) {
            $document->setAuthor(null);
        }

        if (array_key_exists('additionalWebspaces', $data) && null === $data['additionalWebspaces']) {
            $document->setAdditionalWebspaces(null);
        }

        $this->getDocumentManager()->persist(
            $document,
            $locale,
            [
                'user' => $this->getUser()->getId(),
                'clear_missing_content' => false,
            ]
        );
    }
private function persistDocument ( $ data , $ document , $ locale ) { $ formType = $ this -> getMetadataFactory ( ) -> getMetadataForAlias ( 'article' ) -> getFormType ( ) ; $ form = $ this -> createForm ( $ formType , $ document , [ // disable csrf protection, since we can't produce a token, because the form is cached on the client 'csrf_protection' => false , ] ) ; $ form -> submit ( $ data , false ) ; if ( ! $ form -> isValid ( ) ) { throw new InvalidFormException ( $ form ) ; } if ( array_key_exists ( 'author' , $ data ) && null === $ data [ 'author' ] ) { $ document -> setAuthor ( null ) ; } if ( array_key_exists ( 'additionalWebspaces' , $ data ) && null === $ data [ 'additionalWebspaces' ] ) { $ document -> setAdditionalWebspaces ( null ) ; } $ this -> getDocumentManager ( ) -> persist ( $ document , $ locale , [ 'user' => $ this -> getUser ( ) -> getId ( ) , 'clear_missing_content' => false , ] ) ; }
Persists the document using the given Formation.

@param array  $data
@param object $document
@param string $locale

@throws InvalidFormException
@throws MissingParameterException
Persists the document using the given Formation .