Doctrine\Search\UnitOfWork::commit PHP Method

commit() public method

The operations are executed in the following order: 1) All entity inserts 2) All entity deletions
public commit ( null | object | array $entity = null )
$entity null | object | array
    public function commit($entity = null)
    {
        if ($this->evm->hasListeners(Events::preFlush)) {
            $this->evm->dispatchEvent(Events::preFlush, new Event\PreFlushEventArgs($this->sm));
        }
        //TODO: single/array entity commit handling
        $this->commitRemoved();
        $this->commitPersisted();
        //Force refresh of updated indexes
        if ($entity === true) {
            $client = $this->sm->getClient();
            foreach (array_unique($this->updatedIndexes) as $index) {
                $client->refreshIndex($index);
            }
        }
        $this->clear();
        if ($this->evm->hasListeners(Events::postFlush)) {
            $this->evm->dispatchEvent(Events::postFlush, new Event\PostFlushEventArgs($this->sm));
        }
    }

Usage Example

コード例 #1
0
ファイル: SearchManager.php プロジェクト: revinate/search
 /**
  * Commit all changes
  *
  * @param mixed $object
  * @param bool $refresh
  *
  * @throws Exception\DoctrineSearchException
  */
 public function flush($object = null, $refresh = false)
 {
     $this->unitOfWork->commit($object, $refresh);
 }
All Usage Examples Of Doctrine\Search\UnitOfWork::commit