public function activerAction()
 {
     if (!$this->zfcUserAuthentication()->getIdentity()) {
         $this->redirect()->toRoute('home');
     }
     if ($this->zfcUserAuthentication()->getIdentity()->getRole() != 'auteur') {
         $this->redirect()->toRoute('home');
     }
     $articleId = $this->params('articleID');
     $commentaireId = $this->params('commentaireID');
     $commentaireFactory = new CommentaireFactory();
     $commentaireService = $commentaireFactory->createService($this->getServiceLocator());
     $commentaireService->activerCommentaire($commentaireId);
     $this->redirect()->toRoute('articles - view', array('controller' => 'articles', 'action' => 'view', 'id' => $articleId));
 }
 public function viewAction()
 {
     $articleId = $this->params('id');
     $userRole = $this->zfcUserAuthentication()->getIdentity()->getRole();
     $atricleFactory = new ArticleFactory();
     $articleService = $atricleFactory->createService($this->getServiceLocator());
     $commentaireFactory = new CommentaireFactory();
     $commentaireService = $commentaireFactory->createService($this->getServiceLocator());
     $article = $articleService->getArticleByID($articleId);
     if ($article === null) {
         return $this->notFoundAction();
     }
     $commentaires = $commentaireService->getAllActivesCommentaireFromArticleID($articleId);
     if ($this->zfcUserAuthentication()->getIdentity()) {
         if ($userRole == 'auteur') {
             $commentaires = $commentaireService->getAllCommentaireFromArticleID($articleId);
         }
     }
     $this->getServiceLocator()->get('Zend\\Log')->info('Accès à la page view articles : Titre article => ' . $article->getTitre());
     return new ViewModel(array('article' => $article, 'commentaires' => $commentaires, 'userRole' => $userRole));
 }