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));
}
}