SHARE
TWEET

MovieController

a guest Oct 4th, 2017 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public function addAction(Request $request)
  2.     {
  3.         $form = $this->createForm(MoviePersonForm::class);
  4.  
  5.         $form->handleRequest($request);
  6.  
  7.         if($form->isSubmitted() && $form->isValid())
  8.         {
  9.             $movie = new Movie();
  10.             $movie['name'] = $form['movie_name']->getData();
  11.             $movie['year'] = $form['movie_year']->getData();
  12.             $movie['description'] = $form['movie_description']->getData();
  13.  
  14.             $em = $this->getDoctrine()->getManager();
  15.             $em->persist($movie);
  16.             $em->flush();
  17.  
  18.             $this->addFlash('success', 'Movie created');
  19.  
  20.             return $this->redirectToRoute('cms_list_movie');
  21.         }
  22.  
  23.         return $this->render('cms/movie/crew.html.twig',[
  24.             'MoviePersonForm' => $form->createView()
  25.         ]);
  26.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top