Doctrine\ORM\UnitOfWork::removeFromIdentityMap PHP Method

removeFromIdentityMap() public method

INTERNAL: Removes an entity from the identity map. This effectively detaches the entity from the persistence management of Doctrine.
public removeFromIdentityMap ( object $entity ) : boolean
$entity object
return boolean
    public function removeFromIdentityMap($entity)
    {
        $oid = spl_object_hash($entity);
        $classMetadata = $this->em->getClassMetadata(get_class($entity));
        $idHash = implode(' ', $this->entityIdentifiers[$oid]);
        if ($idHash === '') {
            throw new InvalidArgumentException("The given entity has no identity.");
        }
        $className = $classMetadata->rootEntityName;
        if (isset($this->identityMap[$className][$idHash])) {
            unset($this->identityMap[$className][$idHash]);
            //$this->entityStates[$oid] = self::STATE_DETACHED;
            return true;
        }

        return false;
    }