Ojs\JournalBundle\Controller\ManagerController::updateArticleTypesAction PHP Метод

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

public updateArticleTypesAction ( Request $request ) : RedirectResponse | Response
$request Symfony\Component\HttpFoundation\Request
Результат Symfony\Component\HttpFoundation\RedirectResponse | Symfony\Component\HttpFoundation\Response
    public function updateArticleTypesAction(Request $request)
    {
        $eventDispatcher = $this->get('event_dispatcher');
        $em = $this->getDoctrine()->getManager();
        $entity = $this->get('ojs.journal_service')->getSelectedJournal(false);
        $this->throw404IfNotFound($entity);
        if (!$this->isGranted('EDIT', $entity)) {
            throw new AccessDeniedException("You are not authorized for this page!");
        }
        $form = $this->createArticleTypesEditForm($entity);
        $form->handleRequest($request);
        if ($form->isValid()) {
            $event = new JournalEvent($entity);
            $eventDispatcher->dispatch(JournalEvents::PRE_UPDATE, $event);
            $em->persist($event->getJournal());
            $em->flush();
            $event = new JournalEvent($event->getJournal());
            $eventDispatcher->dispatch(JournalEvents::POST_UPDATE, $event);
            if ($event->getResponse()) {
                return $event->getResponse();
            }
            $this->successFlashBag('successful.update');
            return $this->redirectToRoute('ojs_article_types_settings_index', ['journalId' => $entity->getId()]);
        }
        return $this->render('OjsJournalBundle:Manager:article_types.html.twig', array('entity' => $entity, 'form' => $form->createView()));
    }