diff --git a/newscoop/library/Newscoop/Services/IssueService.php b/newscoop/library/Newscoop/Services/IssueService.php index 6dde3c87af..01c0c1c2bc 100644 --- a/newscoop/library/Newscoop/Services/IssueService.php +++ b/newscoop/library/Newscoop/Services/IssueService.php @@ -140,6 +140,10 @@ public function issueResolver(Request $request) */ public function getLatestPublishedIssue() { + if (!$this->publicationService->getPublication()) { + return; + } + $issues = $this->publicationService->getPublication()->getIssues()->toArray(); usort($issues, function ($x, $y) { return $y->getId() - $x->getId(); diff --git a/newscoop/library/Newscoop/Services/ThemesService.php b/newscoop/library/Newscoop/Services/ThemesService.php index 4d85844b85..d4a2c87c07 100644 --- a/newscoop/library/Newscoop/Services/ThemesService.php +++ b/newscoop/library/Newscoop/Services/ThemesService.php @@ -69,6 +69,10 @@ public function __construct( public function getThemePath() { $issue = $this->issueService->getIssue(); + if (!$issue) { + return; + } + $languageId = $issue->getLanguageId(); $publication = $this->publicationService->getPublication(); $cacheKeyThemePath = $this->cacheService->getCacheKey(array('getThemePath', $languageId, $publication->getId(), $issue->getNumber()), 'issue'); diff --git a/newscoop/src/Newscoop/NewscoopBundle/EventListener/OldPluginsTranslationListener.php b/newscoop/src/Newscoop/NewscoopBundle/EventListener/OldPluginsTranslationListener.php index 5d48e0fcdb..c04c9a7c1f 100644 --- a/newscoop/src/Newscoop/NewscoopBundle/EventListener/OldPluginsTranslationListener.php +++ b/newscoop/src/Newscoop/NewscoopBundle/EventListener/OldPluginsTranslationListener.php @@ -41,11 +41,16 @@ public function onRequest(GetResponseEvent $event) if ($this->cacheService->contains($cacheKey)) { $files = $this->cacheService->fetch($cacheKey); } else { + $dir = __DIR__.'/../../../../plugins/*/admin-files/translations'; + if (!file_exists($dir)) { + return; + } + $finder = new Finder(); $extension = $locale.'.yml'; $files = array(); - $finder->files()->in(__DIR__.'/../../../../plugins/*/admin-files/translations'); + $finder->files()->in($dir); $finder->files()->name('*.'.$locale.'.yml'); foreach ($finder as $file) {