src/Controller/ApplicationController.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\VisaApplicant;
  4. use App\Form\VisaApplicantType;
  5. use Boab\CmsBundle\Controller\BaseController;
  6. use Symfony\Component\HttpFoundation\Request;
  7. use Symfony\Component\HttpFoundation\Response;
  8. use Symfony\Component\Routing\Annotation\Route;
  9. class ApplicationController extends BaseController
  10. {
  11.     #[Route('/application/visa'name'visa_application')]
  12.     public function index(Request $request): Response
  13.     {
  14.         $form $this->createForm(VisaApplicantType::class, new VisaApplicant,[
  15.             "action" => $this->router->generate('visa_application'),
  16.             "method" => "POST"
  17.         ]);
  18.         $form->handleRequest($request);
  19.         if($form->isSubmitted() && $form->isValid()){
  20.             $data $form->getData();
  21.             return $this->redirect($this->router->generate('visa_application',['status'=>'success']));
  22.         }
  23.         return $this->render('application/visa.html.twig', [
  24.             'controller_name' => 'BookingController',
  25.             'form' => $form->createView(),
  26.             'pageTitle' => 'Visa Application'
  27.         ]);
  28.     } 
  29. }