Doctrine\ODM\MongoDB\UnitOfWork::scheduleForDelete PHP Method

scheduleForDelete() public method

INTERNAL: Schedules a document for deletion.
public scheduleForDelete ( object $document )
$document object
    public function scheduleForDelete($document)
    {
        $oid = spl_object_hash($document);
        if (isset($this->documentInsertions[$oid])) {
            if ($this->isInIdentityMap($document)) {
                $this->removeFromIdentityMap($document);
            }
            unset($this->documentInsertions[$oid]);
            return;
            // document has not been persisted yet, so nothing more to do.
        }
        if (!$this->isInIdentityMap($document)) {
            return;
            // ignore
        }
        $this->removeFromIdentityMap($document);
        $this->documentStates[$oid] = self::STATE_REMOVED;
        if (isset($this->documentUpdates[$oid])) {
            unset($this->documentUpdates[$oid]);
        }
        if (!isset($this->documentDeletions[$oid])) {
            $this->documentDeletions[$oid] = $document;
        }
    }
UnitOfWork