From 7708dc99fb53ef45adedb40996ad0d71331f3fe6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Miko=C5=82ajczuk?= Date: Thu, 14 Jan 2016 10:38:45 +0000 Subject: [PATCH] [CS-5844] fix implementation --- newscoop/library/Newscoop/Entity/Article.php | 10 ++++++++++ .../Controller/BackendPublicationsController.php | 6 +++--- .../NewscoopBundle/Controller/PluginsController.php | 2 +- .../EventListener/OldPluginsTranslationListener.php | 2 +- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/newscoop/library/Newscoop/Entity/Article.php b/newscoop/library/Newscoop/Entity/Article.php index 8c2af7ba26..41b980cdfd 100755 --- a/newscoop/library/Newscoop/Entity/Article.php +++ b/newscoop/library/Newscoop/Entity/Article.php @@ -1825,4 +1825,14 @@ public function setSectionId($sectionId) return $this; } + + /** + * Get comments count + * + * @return integer + */ + public function getCommentsCount() + { + return $this->comments_count; + } } diff --git a/newscoop/src/Newscoop/NewscoopBundle/Controller/BackendPublicationsController.php b/newscoop/src/Newscoop/NewscoopBundle/Controller/BackendPublicationsController.php index ebb23d6e55..ffbe8b219c 100644 --- a/newscoop/src/Newscoop/NewscoopBundle/Controller/BackendPublicationsController.php +++ b/newscoop/src/Newscoop/NewscoopBundle/Controller/BackendPublicationsController.php @@ -82,8 +82,8 @@ public function editAction(Request $request, Publication $publication) } $publicationIssuesLanguages = array(); - if (is_array($publication->getIssues())) { - foreach ($publication->getIssues() as $key => $issue) { + if ($publication->getIssues()->count() > 0) { + foreach ($publication->getIssues() as $issue) { if (!in_array($issue->getLanguageCode(), $publicationIssuesLanguages)) { $publicationIssuesLanguages[] = $issue->getLanguageCode(); } @@ -191,7 +191,7 @@ private function processRequest($request, $form, $publication = null) } $publicationIssuesLanguages = array(); - if (is_array($publication->getIssues())) { + if ($publication->getIssues()->count() > 0) { foreach ($publication->getIssues() as $key => $issue) { if (!array_key_exists($issue->getLanguageCode(), $publicationIssuesLanguages)) { $publicationIssuesLanguages[$issue->getLanguageCode()] = $issue->getLanguage(); diff --git a/newscoop/src/Newscoop/NewscoopBundle/Controller/PluginsController.php b/newscoop/src/Newscoop/NewscoopBundle/Controller/PluginsController.php index 5a31b29775..822679a01f 100644 --- a/newscoop/src/Newscoop/NewscoopBundle/Controller/PluginsController.php +++ b/newscoop/src/Newscoop/NewscoopBundle/Controller/PluginsController.php @@ -76,7 +76,7 @@ public function indexAction(Request $request) } } - // check if private plugins is writable + // check if private plugins is writable $privatePluginsPathWritable = is_writable($pluginService->getPluginsDir().self::PRIVATE_PLUGINS_DIR); // search for private plugins diff --git a/newscoop/src/Newscoop/NewscoopBundle/EventListener/OldPluginsTranslationListener.php b/newscoop/src/Newscoop/NewscoopBundle/EventListener/OldPluginsTranslationListener.php index fb202ca5b1..4bb3daa040 100644 --- a/newscoop/src/Newscoop/NewscoopBundle/EventListener/OldPluginsTranslationListener.php +++ b/newscoop/src/Newscoop/NewscoopBundle/EventListener/OldPluginsTranslationListener.php @@ -9,7 +9,7 @@ use Symfony\Component\HttpKernel\Event\GetResponseEvent; use Symfony\Component\Finder\Finder; -use Symfony\Component\Translation\Translator; +use Symfony\Component\Translation\TranslatorInterface as Translator; use Symfony\Component\Translation\Loader\YamlFileLoader; /**