Ojs\JournalBundle\Controller\ArticleController::newAction PHP Метод

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

Displays a form to create a new article entity
public newAction ( ) : Response
Результат Symfony\Component\HttpFoundation\Response
    public function newAction()
    {
        $journal = $this->get('ojs.journal_service')->getSelectedJournal();
        $this->throw404IfNotFound($journal);
        if (!$this->isGranted('CREATE', $journal, 'articles')) {
            throw new AccessDeniedException("You not authorized for this page!");
        }
        $entity = new Article();
        $form = $this->createCreateForm($entity, $journal);
        $em = $this->getDoctrine()->getManager();
        $submissionSetting = $em->getRepository('OjsJournalBundle:SubmissionSetting')->findOneBy([]);
        $abstractTemplates = [];
        if ($submissionSetting) {
            /** @var SubmissionSettingTranslation $translation */
            foreach ($submissionSetting->getTranslations() as $translation) {
                $abstractTemplates[$translation->getLocale()] = $translation->getSubmissionAbstractTemplate();
            }
        }
        $data = ['entity' => $entity, 'form' => $form->createView(), 'abstractTemplates' => $abstractTemplates, 'dispatch' => true];
        return $this->render('OjsJournalBundle:Article:new.html.twig', $data);
    }