/** * @param \Blog\Model\Entity\Article $articleEntity * @return \Blog\Service\CommentService */ public function createComment(array $data, Article $articleEntity) { $commentEntity = new Comment(); // Données du formulaire $commentEntity->setContent($data['content']); // Données à récupérer $commentEntity->setArticle($articleEntity); $commentEntity->setUser($this->getServiceLocator()->get('BlogUserService')->getCurrentUserEntity()); // Création du commentaire $this->getServiceLocator()->get('CommentRepository')->createCommentEntity($commentEntity); return $this; }