Ojs\JournalBundle\Entity\Journal::addArticleType PHP Method

addArticleType() public method

Add articleType
public addArticleType ( ArticleTypes $articleType ) : Journal
$articleType ArticleTypes
return Journal
    public function addArticleType(ArticleTypes $articleType)
    {
        $this->articleTypes[] = $articleType;
        return $this;
    }

Usage Example

 /**
  * @param Journal $journal
  */
 private function normalizeSetting(Journal $journal)
 {
     $count = $journal->getArticleTypes()->count();
     if ($count > 0) {
         return;
     }
     foreach ($this->allArticleTypes as $articleType) {
         $journal->addArticleType($articleType);
     }
     $this->em->persist($journal);
 }
Journal