public function scheduleMove($document, $targetPath)
{
$oid = spl_object_hash($document);
$state = $this->getDocumentState($document);
switch ($state) {
case self::STATE_NEW:
unset($this->scheduledInserts[$oid]);
break;
case self::STATE_REMOVED:
unset($this->scheduledRemovals[$oid]);
break;
case self::STATE_DETACHED:
throw new InvalidArgumentException('Detached document passed to move(): ' . self::objToStr($document, $this->dm));
}
$this->scheduledMoves[$oid] = array($document, $targetPath);
$this->setDocumentState($oid, self::STATE_MANAGED);
}