Ojs\JournalBundle\Entity\SubjectTranslation::setSubject PHP Method

setSubject() public method

public setSubject ( string $subject )
$subject string
    public function setSubject($subject)
    {
        $this->subject = $subject;
        return $this;
    }

Usage Example

 private function normalizeSubjects()
 {
     $this->io->newLine();
     $this->io->text('normalizing subjects');
     $this->getContainer()->getParameter('locale');
     $this->io->progressStart();
     $subjects = $this->em->getRepository('OjsJournalBundle:Subject')->findAll();
     foreach ($subjects as $subject) {
         $getTranslation = $this->em->getRepository('OjsJournalBundle:SubjectTranslation')->findOneBy(['translatable' => $subject, 'locale' => $this->locale]);
         if (!$getTranslation) {
             $this->io->progressAdvance();
             $newSubjectTranslation = new SubjectTranslation();
             $newSubjectTranslation->setTranslatable($subject);
             $newSubjectTranslation->setLocale($this->locale);
             $newSubjectTranslation->setSubject('-');
             $this->em->persist($newSubjectTranslation);
         }
     }
     $this->em->flush();
     $this->io->newLine();
 }
All Usage Examples Of Ojs\JournalBundle\Entity\SubjectTranslation::setSubject