Пример #1
0
 /**
  * @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 getId()
 {
     if ($this->__isInitialized__ === false) {
         return (int) parent::getId();
     }
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getId', array());
     return parent::getId();
 }