Ojs\AdminBundle\Controller\AdminArticleTypeController::createAction PHP Method

createAction() public method

Creates a new ArticleTypes entity.
public createAction ( Request $request ) : RedirectResponse | Response
$request Symfony\Component\HttpFoundation\Request
return Symfony\Component\HttpFoundation\RedirectResponse | Symfony\Component\HttpFoundation\Response
    public function createAction(Request $request)
    {
        $entity = new ArticleTypes();
        $form = $this->createCreateForm($entity);
        $form->handleRequest($request);
        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->persist($entity);
            $em->flush();
            $this->successFlashBag('successful.create');
            return $this->redirect($this->generateUrl('ojs_admin_article_type_show', array('id' => $entity->getId())));
        }
        return $this->render('OjsAdminBundle:AdminArticleType:new.html.twig', array('entity' => $entity, 'form' => $form->createView()));
    }