Ojs\JournalBundle\Controller\DesignController::createAction PHP Метод

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

Creates a new Design entity.
public createAction ( Request $request ) : RedirectResponse | Response
$request Symfony\Component\HttpFoundation\Request
Результат Symfony\Component\HttpFoundation\RedirectResponse | Symfony\Component\HttpFoundation\Response
    public function createAction(Request $request)
    {
        $em = $this->getDoctrine()->getManager();
        $journal = $this->get('ojs.journal_service')->getSelectedJournal();
        if (!$this->isGranted('CREATE', $journal, 'design')) {
            throw new AccessDeniedException("You are not authorized for create a this journal's design!");
        }
        $entity = new Design();
        $form = $this->createCreateForm($entity, $journal);
        $form->handleRequest($request);
        if ($form->isValid()) {
            $entity->setContent($this->prepareDesignContent($entity->getEditableContent()));
            $entity->setOwner($journal);
            $em->persist($entity);
            $em->flush();
            $this->successFlashBag('successful.create');
            return $this->redirectToRoute('ojs_journal_design_show', ['id' => $entity->getId(), 'journalId' => $journal->getId()]);
        }
        return $this->render('OjsJournalBundle:Design:new.html.twig', array('form' => $form->createView()));
    }