@@ -85,10 +85,10 @@ |
||
85 | 85 | |
86 | 86 | $postId = $postModel->newPost($title, $postImage, $idCategory, $article, $idUser, $published, $onFrontpage, $postSlug); |
87 | 87 | |
88 | - echo "<p>new post ID : " . $postId . "</p>"; |
|
88 | + echo "<p>new post ID : ".$postId."</p>"; |
|
89 | 89 | |
90 | 90 | foreach ($posts["tags"] as $tag) { |
91 | - if(isset($tag["id"])){ |
|
91 | + if (isset($tag["id"])) { |
|
92 | 92 | $tagModel->addTagToPost($postId, $tag["id"]); |
93 | 93 | continue; |
94 | 94 | } |
@@ -81,7 +81,7 @@ |
||
81 | 81 | { |
82 | 82 | //if the post already has the tag, do nothing |
83 | 83 | if($this->postHasTag($postId, $tagId)){ |
84 | - return; |
|
84 | + return; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | $sql = "INSERT INTO $this->tagAssoTbl (post_idposts, tag_idtags) VALUES (:postId, :tagId)"; |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | use Core\Container; |
5 | 5 | use Core\Model; |
6 | 6 | |
7 | -class TagsModel extends Model{ |
|
7 | +class TagsModel extends Model { |
|
8 | 8 | |
9 | 9 | private $tagAssoTbl; |
10 | 10 | private $tagTbl; |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $this->bind(':tagName', $tagName); |
41 | 41 | $this->execute(); |
42 | 42 | //if no rows, return zero |
43 | - if(!$this->stmt->rowCount() > 0){ |
|
43 | + if (!$this->stmt->rowCount() > 0) { |
|
44 | 44 | return 0; |
45 | 45 | } |
46 | 46 | return $this->stmt->fetchColumn(); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | public function addTagToPost(int $postId, int $tagId) |
81 | 81 | { |
82 | 82 | //if the post already has the tag, do nothing |
83 | - if($this->postHasTag($postId, $tagId)){ |
|
83 | + if ($this->postHasTag($postId, $tagId)) { |
|
84 | 84 | return; |
85 | 85 | } |
86 | 86 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | { |
102 | 102 | //check if tag doesn't already exist |
103 | 103 | $tagId = $this->getTagId($tag); |
104 | - if($tagId === 0){ |
|
104 | + if ($tagId === 0) { |
|
105 | 105 | $tagId = $this->createNewTag($tag); |
106 | 106 | } |
107 | 107 | $this->addTagToPost($postId, $tagId); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | public function removeTagFromPost(int $postId, int $tagId) |
117 | 117 | { |
118 | 118 | //if the tag isn't present, do nothing |
119 | - if(!$this->postHasTag($postId, $tagId)){ |
|
119 | + if (!$this->postHasTag($postId, $tagId)) { |
|
120 | 120 | return; |
121 | 121 | } |
122 | 122 |