/** * @param Article $articleEntity * @return \Blog\Service\ArticleService */ public function deleteArticle(Article $articleEntity) { // Suppression des tags $tags = $this->getServiceLocator()->get('TagService')->getTagEntitiesByArticleId((int) $articleEntity->getId()); foreach ($tags as $t) { $this->getServiceLocator()->get('TagRepository')->deleteTagEntity($t); } // Suppression des commentaires $comms = $this->getServiceLocator()->get('CommentService')->getCommentEntitiesByArticleId((int) $articleEntity->getId()); foreach ($comms as $c) { $this->getServiceLocator()->get('CommentRepository')->deleteCommentEntity($c); } // Suppression du billet $this->getServiceLocator()->get('ArticleRepository')->deleteArticleEntity($articleEntity); return $this; }
/** * {@inheritDoc} */ public function setCategory($category) { $this->__initializer__ && $this->__initializer__->__invoke($this, 'setCategory', array($category)); return parent::setCategory($category); }
/** * Supprime l'entité Article * @param \Blog\Model\Entity\Article $articleEntity * @return \Blog\Model\Entity\Article */ public function deleteArticleEntity(Article $articleEntity) { $articleEntity->setIsDeleted(1); $this->_em->flush(); return $articleEntity; }