public function isInIdentityMap($object): bool
    {
        $oid = spl_object_hash($object);
        if (! isset($this->objects[$oid])) {
            return false;
        }

        $class = $this->manager->getClassMetadata(get_class($object));
        $id = $class->getSingleIdentifier($object);

        if (empty($id)) {
            return false;
        }

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