Ojs\CoreBundle\Command\NormalizeTranslatableObjectsCommand::normalizeSubjects PHP Метод

normalizeSubjects() приватный Метод

private normalizeSubjects ( )
    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();
    }