Newscoop\Entity\Repository\SectionRepository::findSectionByArticle PHP Method

findSectionByArticle() public method

public findSectionByArticle ( $article )
    public function findSectionByArticle($article)
    {
        $em = $this->getEntityManager();
        $issue = $em->getRepository('Newscoop\\Entity\\Issue')->findOneBy(array('language' => $article->getLanguage(), 'publication' => $article->getPublication(), 'number' => $article->getIssueId()));
        if ($issue === null) {
            return;
        }
        $section = $em->getRepository('Newscoop\\Entity\\Section')->findOneBy(array('language' => $article->getLanguage(), 'publication' => $article->getPublication(), 'issue' => $issue, 'number' => $article->getSectionId()));
        return $section;
    }