Ejemplo n.º 1
0
 /**
  * PendingNodes: Add new nodes to the tree.  The position depends on the
  * $key parameter.
  *
  * @param string              $key  (First|Last)Child, (Next|Prev)Sibling.
  * @param Opus_CollectionNode $collection
  * @return <type>
  */
 protected function addPendingNodes($key = null, $collection = null)
 {
     if (isset($collection)) {
         $collection = parent::addPendingNodes($collection);
     } else {
         $collection = parent::addPendingNodes();
     }
     // TODO: Workaround for missing/wrong parent-handling: If parent model
     // TODO: is already stored, we can get it's Id and RoleId before we
     // TODO: reach _storePendingNodes.  (Copy-paste!)
     if ($collection->isNewRecord()) {
         $collection->setRoleId($this->getRoleId());
         $collection->setPositionId($this->getId());
     }
     $collection->setPositionKey($key);
     return $collection;
 }