private function findComments() { $query = (new CommentQuery())->withReactions()->byPage($this->page->getId())->indexedById(); $this->comments = $this->commentFacade->fetchComments($query)->toArray(); }
/** * @param Page $page * @throws DBALException */ public function removePage(Page $page) { $pageID = $page->getId(); $this->pageRemover->remove($page); $this->onSuccessPageRemoval($page, $pageID); }
/** * @param string $formatString * @param Page $page * @return string * @throws \Nette\Application\UI\InvalidLinkException */ private function createLogMessage($formatString, Page $page) { return sprintf($formatString, $this->user->getId(), $this->user->getUsername(), $this->linkGenerator->link('Pages:Front:Page:show', ['internal_id' => $page->getId()]), $page->isDraft() ? ' draft' : '', $page->getId(), $page->getTitle()); }
/** * @return int */ public function getPageId() { return $this->page->getId(); }
public function onSuccessPageSaving(PageFormControl $pageFormControl, Page $page) { $this->redirect('Page:edit', ['id' => $page->getId()]); }
/** * @param string $newUrlAddress * @param Page $page * @return Url * @throws UrlAlreadyExistsException */ private function redirectPageToUrl($newUrlAddress, Page $page) { $newUrlEntity = $this->createUrl($newUrlAddress); $newUrlEntity->setInternalId($page->getId()); // if we first try to save url entity, the current transaction is marked for // rollback only if there is unique constraint violation. $newUrl = $this->urlFacade->getByPath($newUrlEntity->getUrlPath()); if ($newUrl === null) { $newUrl = $this->urlFacade->saveUrl($newUrlEntity); } $oldUrl = $this->urlFacade->getById($page->getUrlId()); $this->urlFacade->linkUrls($oldUrl, $newUrl); return $newUrl; }