Ojs\AdminBundle\Controller\AdminContactTypeController::createAction PHP Méthode

createAction() public méthode

Creates a new ContactTypes entity.
public createAction ( Request $request ) : RedirectResponse | Response
$request Symfony\Component\HttpFoundation\Request
Résultat Symfony\Component\HttpFoundation\RedirectResponse | Symfony\Component\HttpFoundation\Response
    public function createAction(Request $request)
    {
        $entity = new ContactTypes();
        $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_contact_type_show', array('id' => $entity->getId())));
        }
        return $this->render('OjsAdminBundle:AdminContactType:new.html.twig', array('entity' => $entity, 'form' => $form->createView()));
    }