/** * @param int $sectionId * @return SelectBox */ public function create($sectionId) { $selection = $this->pageFacade->all(); $this->pageFilter->filterSection($selection, $sectionId); $selection->select('page.id, page.name'); $selection->order('name'); return new SelectBox('Stránka', $selection->fetchPairs('id', 'name')); }
/** * @param $id * @return \Nette\Database\Table\Selection */ public function page($id) { return $this->pageFilter->filterId($this->all(), $id); }
/** * @param int $pageId * @return array */ function getPageSection($pageId) { $context = $this->sectionFacade->all(); $this->pageFilter->filterId($context, $pageId, ':page_has_section'); return $context->fetchPairs('id', 'id'); }
/** * @param int $id * @param int[] $ids */ public function setSection($id, $ids) { $currentIds = $this->pageFilter->filterId($this->all(), $id)->select(':page_has_section.section.id')->fetchPairs('id', 'id'); $this->pageRepository->reassignSection($id, $ids, $currentIds); }