예제 #1
0
 private function findComments()
 {
     $query = (new CommentQuery())->withReactions()->byPage($this->page->getId())->indexedById();
     $this->comments = $this->commentFacade->fetchComments($query)->toArray();
 }
예제 #2
0
파일: PageFacade.php 프로젝트: blitzik/CMS
 /**
  * @param Page $page
  * @throws DBALException
  */
 public function removePage(Page $page)
 {
     $pageID = $page->getId();
     $this->pageRemover->remove($page);
     $this->onSuccessPageRemoval($page, $pageID);
 }
예제 #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());
 }
예제 #4
0
파일: Comment.php 프로젝트: blitzik/CMS
 /**
  * @return int
  */
 public function getPageId()
 {
     return $this->page->getId();
 }
예제 #5
0
 public function onSuccessPageSaving(PageFormControl $pageFormControl, Page $page)
 {
     $this->redirect('Page:edit', ['id' => $page->getId()]);
 }
예제 #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;
 }