Doctrine\OXM\UnitOfWork::addToIdentityMap PHP Метод

addToIdentityMap() публичный Метод

Note that documents in a hierarchy are registered with the class name of the root document.
public addToIdentityMap ( object $xmlEntity ) : boolean
$xmlEntity object The document to register.
Результат boolean TRUE if the registration was successful, FALSE if the identity of the document in question is already managed.
    public function addToIdentityMap($xmlEntity)
    {
        $classMetadata = $this->xem->getClassMetadata(get_class($xmlEntity));
        $id = $this->entityIdentifiers[spl_object_hash($xmlEntity)];
        if ($id === '') {
            throw new \InvalidArgumentException("The given xml entity has no identity.");
        }
        $className = $classMetadata->rootXmlEntityName;
        if (isset($this->identityMap[$className][$id])) {
            return false;
        }
        $this->identityMap[$className][$id] = $xmlEntity;
        if ($xmlEntity instanceof NotifyPropertyChanged) {
            $xmlEntity->addPropertyChangedListener($this);
        }
        return true;
    }