/**
  * @param string|null $objectName
  */
 public function clear($objectName = null)
 {
     $this->objectIdentityMap->clear($objectName);
     $this->objectsToPersist = array();
     $this->objectsToUpdate = array();
     $this->objectsToRemove = array();
     $this->objectChangeSets = new ChangeSets();
     $this->eventDispatcher->dispatchOnClearEvent($objectName);
 }