/** * INTERNAL: * Removes an entity from the identity map. This effectively detaches the * entity from the persistence management of Doctrine. * * @ignore * * @param object $entity * * @return boolean * * @throws ORMInvalidArgumentException */ public function removeFromIdentityMap($entity) { $oid = spl_object_hash($entity); $classMetadata = $this->em->getClassMetadata(get_class($entity)); $idHash = implode(' ', $this->entityIdentifiers[$oid]); if ($idHash === '') { throw ORMInvalidArgumentException::entityHasNoIdentity($entity, "remove from identity map"); } $className = $classMetadata->rootEntityName; if (isset($this->identityMap[$className][$idHash])) { unset($this->identityMap[$className][$idHash]); unset($this->readOnlyObjects[$oid]); //$this->entityStates[$oid] = self::STATE_DETACHED; return true; } return false; }
/** * Schedules an entity for being updated. * * @param object $entity The entity to schedule for being updated. * * @return void * * @throws ORMInvalidArgumentException */ public function scheduleForUpdate($entity) { $oid = spl_object_hash($entity); if (!isset($this->entityIdentifiers[$oid])) { throw ORMInvalidArgumentException::entityHasNoIdentity($entity, "scheduling for update"); } if (isset($this->entityDeletions[$oid])) { throw ORMInvalidArgumentException::entityIsRemoved($entity, "schedule for update"); } if (!isset($this->entityUpdates[$oid]) && !isset($this->entityInsertions[$oid])) { $this->entityUpdates[$oid] = $entity; } }