src/Controller/HomeController.php line 41

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Repository\GhCoursebookingRepository;
  4. use App\Repository\GhCoursesRepository;
  5. use App\Repository\GhTodoRepository;
  6. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  7. use Symfony\Component\Routing\Annotation\Route;
  8. class HomeController extends AbstractController
  9. {
  10.     /**
  11.      * @var GhTodoRepository
  12.      */
  13.     private $ghTodoRepository;
  14.     /**
  15.      * @var GhCoursesRepository
  16.      */
  17.     private $coursesRepository;
  18.     /**
  19.      * @var GhCoursebookingRepository
  20.      */
  21.     private $coursebookingRepository;
  22.     public function __construct(GhTodoRepository $ghTodoRepository,
  23.                                 GhCoursesRepository $coursesRepository,
  24.                                 GhCoursebookingRepository $coursebookingRepository)
  25.     {
  26.         $this->ghTodoRepository $ghTodoRepository;
  27.         $this->coursesRepository $coursesRepository;
  28.         $this->coursebookingRepository $coursebookingRepository;
  29.     }
  30.     /**
  31.      * @Route ("", name="homepage")
  32.      */
  33.     public function homepage()
  34.     {
  35.         if (!$this->getUser()) {
  36.          //   return $this->redirectToRoute('app_login');
  37.         }
  38.         $todoList$this->ghTodoRepository->findBy(['isdone'=>false],['createdAt' =>'DESC']);
  39.         $plist $this->coursesRepository->findBySearch(null,'list');
  40.         $newPlist $this->coursesRepository->findNewPartiList();
  41.         $invoices $this->coursesRepository->findBySearch(null,'invoice-open');
  42.         $confirmations =$this->coursebookingRepository->findNotConfirmed();
  43.         return $this->render('base/homepage.html.twig',[
  44.            'todoList' =>$todoList,
  45.             'plist' =>$plist,
  46.             'newPlist' => $newPlist,
  47.             'invoices' => $invoices,
  48.             'confirmations' =>$confirmations
  49.         ]);
  50.     }
  51.     /**
  52.      * @Route ("/apperror", name="noaccess")
  53.      */
  54.     public function noaccess()
  55.     {
  56.         return $this->render('security/noaccess.html.twig',[
  57.         ]);
  58.     }
  59. }