src/Controller/IndexController.php line 20

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Mongo\Ams\Profile;
  4. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  5. use Symfony\Component\HttpFoundation\Response;
  6. use Symfony\Component\Routing\Annotation\Route;
  7. /**
  8.  * Class IndexController
  9.  */
  10. class IndexController extends AbstractController
  11. {
  12.     /**
  13.      * @Route("/")
  14.      *
  15.      * @return Response
  16.      */
  17.     public function index(): Response
  18.     {
  19.         return $this->redirect('/booking');
  20.     }
  21.     /**
  22.      * Provide global dropdown options
  23.      *
  24.      * @Route("/options/{type}")
  25.      *
  26.      * @param string $type
  27.      *
  28.      * @return Response
  29.      */
  30.     public function options(string $type): Response
  31.     {
  32.         switch ($type) {
  33.             case 'advertisers':
  34.                 $model = new Profile();
  35.                 $options $model->getOptionList();
  36.                 break;
  37.             default:
  38.                 $options null;
  39.                 break;
  40.         }
  41.         return $this->json($options);
  42.     }
  43. }