public function indexOf(Node $node) { $count = $this->count(); for ($i = 0; $i < $count; $i++) { if ($node->getId() == $this->_children[$i]->getId()) { return $i; } } throw new OutOfBoundsException('Node ' . $node->getId() . ' not found'); }
protected function getLastChildPosition(Node $parent) { $parentIdName = $this->getParentIdName(); $query = $this->newQuery(); $pos = $query->where($parentIdName, $parent->getId())->max($this->getPositionName()); if (is_numeric($pos) && $pos) { return (int) $pos + 1; } return 1; }