Newscoop\Services\AuthorService::removeAuthorFromArticle PHP Метод

removeAuthorFromArticle() публичный Метод

Remove author with type from article
public removeAuthorFromArticle ( Article $article, Author $author, AuthorType $authorType ) : ArticleAuthor
$article Newscoop\Entity\Article
$author Newscoop\Entity\Author
$authorType Newscoop\Entity\AuthorType
Результат Newscoop\Entity\ArticleAuthor
    public function removeAuthorFromArticle(Article $article, Author $author, AuthorType $authorType)
    {
        $articleAuthor = $this->em->getRepository('Newscoop\\Entity\\ArticleAuthor')->getArticleAuthor($article->getNumber(), $article->getLanguageCode(), $author->getId(), $authorType->getId())->getOneOrNullResult();
        if (!$articleAuthor) {
            throw new ResourcesConflictException("Author with this type is not attached to article", 409);
        }
        $this->em->remove($articleAuthor);
        $this->em->flush();
        $articleAuthors = $this->em->getRepository('Newscoop\\Entity\\ArticleAuthor')->getArticleAuthors($article->getNumber(), $article->getLanguageCode())->getResult();
        $this->reorderAuthors($this->em, $articleAuthors);
    }