/** * Inserts the current node as last child of given $parent node * The modifications in the current object and the tree * are not persisted until the current object is saved. * * @param $parent Propel object for parent node * @return $this| The current Propel object */ public function insertAsLastChildOf( $parent) { if ($this->isInTree()) { throw new PropelException( 'A object must not already be in the tree to be inserted. Use the moveToLastChildOf() instead.' ); } $left = $parent->getRightValue(); // Update node properties $this->setLeftValue($left); $this->setRightValue($left + 1); $this->setLevel($parent->getLevel() + 1); // update the children collection of the parent $parent->addNestedSetChild($this); // Keep the tree modification query for the save() transaction $this->nestedSetQueries []= array( 'callable' => array('', 'makeRoomForLeaf'), 'arguments' => array($left, $this->isNew() ? null : $this) ); return $this; }