Advertisement
Sajgoniarz

Untitled

Jun 21st, 2018
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.77 KB | None | 0 0
  1.     /**
  2.      * @Route("/accept", name="accept")
  3.      */
  4.     public function acceptAction(Request $request)
  5.     {
  6.         $accept = new Accept();
  7.         $form = $this->getAcceptForm($accept);
  8.        
  9.         $form->handleRequest($request);
  10.  
  11.         if ($form->isSubmitted() && $form->isValid()) {
  12.             $this->infosRepository->save($accept);
  13.             $this->mailerService->send('New accept', $accept);
  14.             $this->addFlash('success', 'Accept ok');
  15.             return $this->redirectToRoute('confirmed');
  16.         }
  17.  
  18.         return $this->render('homepage/form.html.twig', [
  19.             'infos' => $this->infosRepository->getAllActive();
  20.             'form' => $form->createView()
  21.         ]);
  22.     }
  23.  
  24.     private function getAcceptForm(Accept $accept){
  25.         return $this->createForm(AcceptType::class, $accept);
  26.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement