/**
  * 
  * @param int $id_topic : l'ID du topic
  * @return la vue forum/posts : tous les posts d'un topic
  */
 public function actionPosts($id_topic)
 {
     $postRepo = new PostRepository();
     $countQuery = $postRepo->count('forum_post', "id_topic={$id_topic}");
     //Pagination : 5 Items par page
     $pages = new Pagination(['pageSize' => 5, 'totalCount' => $countQuery[0]['ctr']]);
     //GetAll avec Pagination
     $posts = $postRepo->getAll("id_topic={$id_topic}", ['orderBy' => ['createdAt' => SORT_ASC], 'offset' => $pages->offset, 'limit' => $pages->limit]);
     //var_dump($pages);
     $topicRepo = new TopicRepository();
     $topic = $topicRepo->getAll("id={$id_topic}");
     foreach ($posts as $k => $v) {
         $user = User::findOne($v['id_user']);
         $users[$k] = $user->attributes;
     }
     //$author=$user->findIdentity($posts['id_user']);
     return $this->render('posts', ['topic' => $topic, 'posts' => $posts, 'author' => $users, 'pages' => $pages]);
 }
 /**
  * D�cr�mente le score du Post
  * @param int $id : l'ID du Post
  * @return la vue forum/posts
  */
 public function actionVotedown($id = null)
 {
     if ($id == null && isset($_POST['id']) && !empty($_POST['id'])) {
         $id = $_POST['id'];
     }
     $postRepo = new PostRepository();
     $postRepo->vote('moins', "id={$id}");
     $post = $postRepo->getAll("id={$id}");
     /**
      * TODO : Si $post->score < 10, envoie un mail à echos-libres@protonmail.com
      */
     return $this->renderPartial('vote', ['id' => $id, 'score' => $post[0]['score']]);
 }