Checks whether a document is registered in the identity map.

@param object $document
@return boolean
329625
public function isInIdentityMap($document)
    {
        $oid = spl_object_hash($document);

        if ( ! isset($this->documentIdentifiers[$oid])) {
            return false;
        }

        $class = $this->dm->getClassMetadata(get_class($document));

        if ( ! $class->identifier) {
            $id = spl_object_hash($document);
        } else {
            $id = $this->documentIdentifiers[spl_object_hash($document)];
            $id = serialize($class->getDatabaseIdentifierValue($id));
        }

        return isset($this->identityMap[$class->name][$id]);
    }
133928
public function contains($document)
    {
        $oid = is_object($document) ? spl_object_hash($document) : $document;

        return isset($this->documentIds[$oid]) && !isset($this->scheduledRemovals[$oid]);
    }
593252
public function isValidType($object): bool
    {
        if ($this->type == null || $object == null) {
            return true;
        }

        if (is_object($object) && get_class($object) == $this->type) {
            return true;
        }

        return (MDataType::getType($object) == $this->type);
    }
948303
public function isRegistered($identifier)
    {
        if (!parent::isRegistered($identifier)) {

            $this->load();

            return parent::isRegistered($identifier);
        }

        return true;
    }
760458
public function getDocumentActualData($document)
    {
        $class      = $this->dm->getClassMetadata(get_class($document));
        $actualData = [];

        foreach ($class->propertyMetadata as $name => $mapping) {
            // skip not saved attributes
            if ($mapping->notSaved) {
                continue;
            }

            $value = $mapping->getValue($document);

            if ($mapping->isMany() && $value !== null && !($value instanceof PersistentCollectionInterface)) {
                // If $actualData[$name] is not a Collection then use an ArrayCollection.
                if (!$value instanceof Collection) {
                    $value = new ArrayCollection($value);
                }

                // Inject PersistentCollection
                $coll = $this->dm->getConfiguration()->getPersistentCollectionFactory()->create($this->dm, $mapping, $value);
                $coll->setOwner($document, $mapping);
                $coll->setDirty(!$value->isEmpty());
                $mapping->setValue($document, $coll);
                $actualData[$name] = $coll;
            } else {
                $actualData[$name] = $value;
            }
        }

        return $actualData;
    }
568883
public function insert(&$document) {

        if (isset($document[0])) {

            $this->database->connection->beginTransaction();

            foreach ($document as &$doc) {

                if (!\is_array($doc)) continue;

                $res = $this->_insert($doc);

                if (!$res) {
                    $this->database->connection->rollBack();
                    return $res;
                }
            }
            $this->database->connection->commit();
            return \count($document);
        } else {
            return $this->_insert($document);
        }
    }
991076
public function getLocaleForDocument($document)
    {
        $oid = $this->getObjectIdentifier($document);
        $this->assertDocumentExists($document);

        return $this->documentLocaleMap[$oid];
    }
1129759
public function isInIdentityMap($entity)
    {
        $oid = spl_object_id($entity);

        if (empty($this->entityIdentifiers[$oid])) {
            return false;
        }

        $classMetadata = $this->em->getClassMetadata(get_class($entity));
        $idHash        = implode(' ', $this->entityIdentifiers[$oid]);

        return isset($this->identityMap[$classMetadata->getRootClassName()][$idHash]);
    }
25782
public function unlock($document)
    {
        if ($this->getDocumentState($document) != self::STATE_MANAGED) {
            throw new \InvalidArgumentException("Document is not MANAGED.");
        }
        $documentName = get_class($document);
        $this->getDocumentPersister($documentName)->unlock($document);
    }
1037986
public function hasIdentifier($identifier)
    {
        if(!$identifier instanceof ObjectIdentifierInterface) {
            $identifier = $this->getIdentifier($identifier);
        }

        return in_array((string) $identifier, $this->__identifier_list);
    }
1230685
public function hasIdentifier($identifier)
    {
        if(!$identifier instanceof KObjectIdentifierInterface) {
            $identifier = $this->getIdentifier($identifier);
        }

        return in_array((string) $identifier, $this->__identifier_list);
    }
11124
public function canHandle(Document $document) : bool
    {
        return false !== strpos($document->getDOMDocument()->documentElement->tagName, static::ROOT_NODE_TAGNAME);
    }
191997
public function exists(object $document) : bool
    {
        $id = $this->class->getIdentifierObject($document);
        assert($this->collection instanceof Collection);
        return (bool) $this->collection->findOne(['_id' => $id], ['_id']);
    }
121418
public function registerDocument($document, $id)
    {
        $oid = spl_object_hash($document);
        $this->documentIds[$oid] = $id;
        $this->identityMap[$id] = $document;

        // frozen nodes need another state so they are managed but not included for updates
        $frozen = $this->session->nodeExists($id) && $this->session->getNode($id)->isNodeType('nt:frozenNode');

        $this->setDocumentState($oid, $frozen ? self::STATE_FROZEN : self::STATE_MANAGED);

        return $oid;
    }
510063
public function isOdm($entity)
    {
        $annotation = $this->getClassAnnotation($entity, 'Doctrine\ODM\MongoDB\Mapping\Annotations\Document');

        if ($annotation === null) {
            return false;
        }

        return true;
    }
1026201
public function getIdentifier($object)
    {
        $identifier = $this->getMethod($object);

        if (!$identifier) {
            return false;
        }

        return \call_user_func([$object, $identifier]);
    }
997337
public function isNested($entity)
    {
        if ($nestedDocument = $this->getClassAnnotation($entity, self::DOCUMENT_NESTED_CLASS)) {
            return true;
        }

        return false;
    }