private function findComments()
 {
     $query = (new CommentQuery())->withReactions()->byPage($this->page->getId())->indexedById();
     $this->comments = $this->commentFacade->fetchComments($query)->toArray();
 }
Exemple #2
0
 /**
  * @param Page $page
  * @throws DBALException
  */
 public function removePage(Page $page)
 {
     $pageID = $page->getId();
     $this->pageRemover->remove($page);
     $this->onSuccessPageRemoval($page, $pageID);
 }
Exemple #3
0
 /**
  * @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());
 }
Exemple #4
0
 /**
  * @return int
  */
 public function getPageId()
 {
     return $this->page->getId();
 }
Exemple #5
0
 public function onSuccessPageSaving(PageFormControl $pageFormControl, Page $page)
 {
     $this->redirect('Page:edit', ['id' => $page->getId()]);
 }
Exemple #6
0
 /**
  * @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;
 }