Doctrine\ODM\PHPCR\UnitOfWork::scheduleMove PHP Метод

scheduleMove() публичный Метод

public scheduleMove ( $document, $targetPath )
    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);
    }

Usage Example

Пример #1
0
 /**
  * Move the previously persisted document and all its children in the tree
  *
  * Note that this does not update the @Id fields of child documents and
  * neither fields with @Child/Children annotations. If you want to continue
  * working with the manager after a move, you are probably safest calling
  * DocumentManager::clear and re-loading the documents you need to use.
  *
  * @param object $document an already registered document
  * @param string $targetPath the target path including the nodename
  */
 public function move($document, $targetPath)
 {
     if (!is_object($document)) {
         throw new \InvalidArgumentException(gettype($document));
     }
     $this->errorIfClosed();
     $this->unitOfWork->scheduleMove($document, $targetPath);
 }
All Usage Examples Of Doctrine\ODM\PHPCR\UnitOfWork::scheduleMove
UnitOfWork