From 17ffd70c167c69a8d7a5848826d8e9c19893e1cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Muszy=C5=84ski?= Date: Mon, 30 Mar 2015 11:01:20 +0200 Subject: [PATCH] fixed creating article without issue and section via api --- .../library/Newscoop/Services/ArticleService.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/newscoop/library/Newscoop/Services/ArticleService.php b/newscoop/library/Newscoop/Services/ArticleService.php index 4c2b5361e1..5f99237878 100755 --- a/newscoop/library/Newscoop/Services/ArticleService.php +++ b/newscoop/library/Newscoop/Services/ArticleService.php @@ -165,11 +165,17 @@ public function createArticle($articleType, $language, $user, $publication, $att $article->setPublication($publication); $article->setType($articleType); $article->setCreator($user); + $article->setIssueId(0); + $article->setSectionId(0); + if (!is_null($issue)) { + $article->setIssueId($issue->getId()); + $article->setIssue($issue); + } - $article->setIssueId((!is_null($issue)) ? $issue->getId() : 0); - $article->setSectionId((!is_null($section)) ? $section->getId() : 0); - $article->setIssue($issue); - $article->setSection($section); + if (!is_null($section)) { + $article->setSectionId($section->getId()); + $article->setSection($section); + } $this->updateArticleMeta($article, $attributes);