Example #1
0
 /**
  * @param int $id
  * @return array
  */
 public function execute($id)
 {
     if ($this->articleRepository->resultExists((int) $id, $this->date->getCurrentDateTime()) === true) {
         $this->setCacheResponseCacheable($this->config->getSettings(Schema::MODULE_NAME)['cache_lifetime']);
         return ['sidebar_article' => $this->articlesCache->getCache($id)];
     }
 }
Example #2
0
 /**
  * @param int $id
  *
  * @return array
  * @throws \ACP3\Core\Controller\Exception\ResultNotExistsException
  */
 public function execute($id)
 {
     if ($this->articleRepository->resultExists($id, $this->date->getCurrentDateTime()) === true) {
         $this->setCacheResponseCacheable($this->config->getSettings(Schema::MODULE_NAME)['cache_lifetime']);
         $article = $this->articlesCache->getCache($id);
         $this->breadcrumb->replaceAncestor($article['title'], '', true);
         return ['page' => array_merge($article, $this->pageBreaksHelper->splitTextIntoPages($this->view->fetchStringAsTemplate($article['text']), $this->request->getUriWithoutPages()))];
     }
     throw new Core\Controller\Exception\ResultNotExistsException();
 }
 /**
  * @param ModelSaveEvent $event
  */
 public function execute(ModelSaveEvent $event)
 {
     if ($event->isDeleteStatement()) {
         return;
     }
     foreach ($event->getEntryId() as $entryId) {
         $this->articlesCache->getCacheDriver()->delete(Cache::CACHE_ID . $entryId);
         $uri = sprintf(Helpers::URL_KEY_PATTERN, $entryId);
         if ($this->manageMenuItemHelper) {
             $this->manageMenuItemHelper->manageMenuItem($uri, false);
         }
         if ($this->uriAliasManager) {
             $this->uriAliasManager->deleteUriAlias($uri);
         }
     }
 }
 /**
  * @param ModelSaveEvent $event
  */
 public function execute(ModelSaveEvent $event)
 {
     $this->cache->saveCache($event->getEntryId());
 }