Domain/Domain.php
protected function doPersistResource(ResourceInterface $resource, $autoCommit, $type)
    {
        $object = $resource->getRealData();
        $this->validateUndeleteResource($resource, $type);
        $this->validateResource($resource, $type);
        $successStatus = $this->getSuccessStatus($type, $object);
        $hasFlushError = false;

        if ($resource->isValid()) {
            try {
                $this->om->persist($object);
                $hasFlushError = $this->doAutoCommitFlushTransaction($resource, $autoCommit);
            } catch (\Exception $e) {
                $hasFlushError = DomainUtil::injectErrorMessage($this->translator, $resource, $e, $this->debug);
            }
        }

        return [$successStatus, $hasFlushError];
    }
protected function doPersistResource(ResourceInterface $resource, $autoCommit, $type)
    {
        $object = $resource->getRealData();
        $this->validateUndeleteResource($resource, $type);
        $this->validateResource($resource, $type);
        $successStatus = $this->getSuccessStatus($type, $object);
        $hasFlushError = false;

        if ($resource->isValid()) {
            try {
                $this->om->persist($object);
                $hasFlushError = $this->doAutoCommitFlushTransaction($resource, $autoCommit);
            } catch (\Exception $e) {
                $hasFlushError = DomainUtil::injectErrorMessage($this->translator, $resource, $e, $this->debug);
            }
        }

        return [$successStatus, $hasFlushError];
    }
protected function doPersistResource ( ResourceInterface $ resource , $ autoCommit , $ type ) { $ object = $ resource -> getRealData ( ) ; $ this -> validateUndeleteResource ( $ resource , $ type ) ; $ this -> validateResource ( $ resource , $ type ) ; $ successStatus = $ this -> getSuccessStatus ( $ type , $ object ) ; $ hasFlushError = false ; if ( $ resource -> isValid ( ) ) { try { $ this -> om -> persist ( $ object ) ; $ hasFlushError = $ this -> doAutoCommitFlushTransaction ( $ resource , $ autoCommit ) ; } catch ( \ Exception $ e ) { $ hasFlushError = DomainUtil :: injectErrorMessage ( $ this -> translator , $ resource , $ e , $ this -> debug ) ; } } return [ $ successStatus , $ hasFlushError ] ; }
Do persist a resource.

@param ResourceInterface $resource   The resource
@param bool              $autoCommit Commit transaction for each resource or all
(continue the action even if there is an error on a resource)
@param int               $type       The type of persist action

@return array The successStatus and hasFlushError value
Do persist a resource .