/** * @param int $id * @return \Nette\Utils\ArrayHash * @throws \Nette\InvalidStateException */ public function findCurrent($id) { $map = $this->tree->getMap(); if (!isset($map[$id])) { throw new \Nette\InvalidStateException(); } return $map[$id]; }
/** * @param int $currentId * @return array */ private function buildMap($currentId) { $map = $this->tree->getMap(); $currentMap = []; while ($currentId) { array_unshift($currentMap, $currentId); $currentId = $map[$currentId]['parentId']; } return $currentMap; }