public function createAction(Request $request)
    {
        $mailingList = new MailingList();

        $form = $this->createForm(MailingListType::class, $mailingList, [
            'action' => $this->generateUrl('opifer_mailing_list_mailing_list_create'),
        ]);

        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->persist($mailingList);
            $em->flush();

            return $this->redirectToRoute('opifer_mailing_list_mailing_list_index');
        }

        return $this->render('OpiferMailingListBundle:MailingList:create.html.twig', [
            'form' => $form->createView(),
        ]);
    }
public function createAction(Request $request)
    {
        $mailingList = new MailingList();

        $form = $this->createForm(MailingListType::class, $mailingList, [
            'action' => $this->generateUrl('opifer_mailing_list_mailing_list_create'),
        ]);

        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->persist($mailingList);
            $em->flush();

            return $this->redirectToRoute('opifer_mailing_list_mailing_list_index');
        }

        return $this->render('OpiferMailingListBundle:MailingList:create.html.twig', [
            'form' => $form->createView(),
        ]);
    }
public function createAction ( Request $ request ) { $ mailingList = new MailingList ( ) ; $ form = $ this -> createForm ( MailingListType :: class , $ mailingList , [ 'action' => $ this -> generateUrl ( 'opifer_mailing_list_mailing_list_create' ) , ] ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isSubmitted ( ) && $ form -> isValid ( ) ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ em -> persist ( $ mailingList ) ; $ em -> flush ( ) ; return $ this -> redirectToRoute ( 'opifer_mailing_list_mailing_list_index' ) ; } return $ this -> render ( 'OpiferMailingListBundle:MailingList:create.html.twig' , [ 'form' => $ form -> createView ( ) , ] ) ; }
Add new Mailing List.
Add new Mailing List .