Deprecated: Constant E_STRICT is deprecated in /var/www/PixelForce/vendor/symfony/error-handler/ErrorHandler.php on line 58

Deprecated: Constant E_STRICT is deprecated in /var/www/PixelForce/vendor/symfony/error-handler/ErrorHandler.php on line 76
Symfony Profiler

src/Controller/IndexController.php line 20

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\User;
  4. use Symfony\Bundle\FrameworkBundle\Console\Application;
  5. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  6. use Symfony\Component\Console\Input\ArrayInput;
  7. use Symfony\Component\Console\Output\BufferedOutput;
  8. use Symfony\Component\HttpFoundation\Response;
  9. use Symfony\Component\HttpKernel\KernelInterface;
  10. use Symfony\Component\Process\Process;
  11. use Symfony\Component\Routing\Annotation\Route;
  12. class IndexController extends AbstractController
  13. {
  14.     /**
  15.      * @Route("/", name="app_index")
  16.      */
  17.     public function index(): Response
  18.     {
  19.         return $this->redirectToRoute('app_dashboard');
  20.     }
  21.     /**
  22.      * @Route("/dashboard", name="app_dashboard")
  23.      */
  24.     public function dashboard()
  25.     {
  26.         if(in_array(User::ROLE_AGENT$this->getUser()->getRoles())) {
  27.             return $this->redirectToRoute('agent_home');
  28.         }
  29.         elseif(in_array(User::ROLE_COACH$this->getUser()->getRoles())) {
  30.             return $this->redirectToRoute('coach_dashboard_index');
  31.         }
  32.         elseif(in_array(User::ROLE_ADMINISTRATEUR$this->getUser()->getRoles())) {
  33.             return $this->redirectToRoute('admin_dashboard');
  34.         }
  35.         else{
  36.             return $this->render('global/index/dashboard.html.twig', [
  37.                 'controller_name' => 'IndexController',
  38.             ]);
  39.         }
  40.         
  41.     }
  42.     /**
  43.      * @Route("/launch_messenger", name="app_launch_messenger")
  44.      */
  45.     public function launch_messenger(KernelInterface $kernel)
  46.     {
  47.         $output null;
  48.         $return null;
  49.         $projetctDir $kernel->getProjectDir();
  50.         exec('php '.$projetctDir.'/bin/console messenger:consume async --memory-limit=128M --time-limit=3600'$output$return);
  51.         return $this->json([
  52.             'output' => $output,
  53.             'return_var' =>$return
  54.         ]);
  55.     }
  56. }