/** * @param ModelSaveEvent $event */ public function execute(ModelSaveEvent $event) { if (!$event->isDeleteStatement()) { return; } foreach ($event->getEntryId() as $item) { if ($this->commentsHelpers) { $this->commentsHelpers->deleteCommentsByModuleAndResult($this->modules->getModuleId(Schema::MODULE_NAME), $item); } $this->cache->getCacheDriver()->delete(Cache::CACHE_ID . $item); if ($this->uriAliasManager) { $this->uriAliasManager->deleteUriAlias(sprintf(Helpers::URL_KEY_PATTERN, $item)); } } }
/** * @param int $id * * @return array * @throws \ACP3\Core\Controller\Exception\ResultNotExistsException */ public function execute($id) { if ($this->newsRepository->resultExists($id, $this->date->getCurrentDateTime()) == 1) { $this->setCacheResponseCacheable($this->config->getSettings(Schema::MODULE_NAME)['cache_lifetime']); $news = $this->newsCache->getCache($id); $this->breadcrumb->append($this->translator->t('news', 'news'), 'news'); if ($this->newsSettings['category_in_breadcrumb'] == 1) { $this->breadcrumb->append($news['category_title'], 'news/index/index/cat_' . $news['category_id']); } $this->breadcrumb->append($news['title']); $news['text'] = $this->view->fetchStringAsTemplate($news['text']); $news['target'] = $news['target'] == 2 ? ' target="_blank"' : ''; return ['news' => $news, 'dateformat' => $this->newsSettings['dateformat'], 'comments_allowed' => $this->commentsActive === true && $news['comments'] == 1]; } throw new Core\Controller\Exception\ResultNotExistsException(); }
/** * @param ModelSaveEvent $event */ public function execute(ModelSaveEvent $event) { $this->cache->saveCache($event->getEntryId()); }