public function addToIdentityMap(object $document) : bool
    {
        $class = $this->dm->getClassMetadata(get_class($document));
        $id    = $this->getIdForIdentityMap($document);

        if (isset($this->identityMap[$class->name][$id])) {
            return false;
        }

        $this->identityMap[$class->name][$id] = $document;

        if ($document instanceof NotifyPropertyChanged &&
            ( ! $document instanceof GhostObjectInterface || $document->isProxyInitialized())) {
            $document->addPropertyChangedListener($this);
        }

        return true;
    }
public function addToIdentityMap(object $document) : bool
    {
        $class = $this->dm->getClassMetadata(get_class($document));
        $id    = $this->getIdForIdentityMap($document);

        if (isset($this->identityMap[$class->name][$id])) {
            return false;
        }

        $this->identityMap[$class->name][$id] = $document;

        if ($document instanceof NotifyPropertyChanged &&
            ( ! $document instanceof GhostObjectInterface || $document->isProxyInitialized())) {
            $document->addPropertyChangedListener($this);
        }

        return true;
    }
public function addToIdentityMap ( object $ document ) : bool { $ class = $ this -> dm -> getClassMetadata ( get_class ( $ document ) ) ; $ id = $ this -> getIdForIdentityMap ( $ document ) ; if ( isset ( $ this -> identityMap [ $ class -> name ] [ $ id ] ) ) { return false ; } $ this -> identityMap [ $ class -> name ] [ $ id ] = $ document ; if ( $ document instanceof NotifyPropertyChanged && ( ! $ document instanceof GhostObjectInterface || $ document -> isProxyInitialized ( ) ) ) { $ document -> addPropertyChangedListener ( $ this ) ; } return true ; }
Registers a document in the identity map.

Note that documents in a hierarchy are registered with the class name of
the root document. Identifiers are serialized before being used as array
keys to allow differentiation of equal, but not identical, values.

@internal
Registers a document in the identity map .