0
我想清除我的節點樹用於測試目的,我不能刪除根節點的所有子節點。學說PHPCR:如何從根文件中刪除兒童?
<?php
$dm = $this->getDocumentManager();
$rootDoc = $dm->find(null,'/');
/** @var AbstractDocument[] $children */
$children = $rootDoc->getChildren();
foreach ($children as $child) {
echo $child->getUuid()."\n";
$dm->remove($child);
}
$dm->flush();
我得到下面的異常
Doctrine\ODM\PHPCR\PHPCRException: Cannot move/copy children by assignment as it would be ambiguous. Please use the DocumentManager::move() or PHPCR\Session::copy() operations for this: [..]
根節點是一般的情況下,是AbstractDocument有家長ID策略。