src/Controller/MainController.php line 21

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\Export;
  4. use App\Entity\Import;
  5. use App\Service\Rosh\Logic\DashBoardLogic;
  6. use Doctrine\ORM\EntityManagerInterface;
  7. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  8. use Symfony\Component\HttpFoundation\Response;
  9. use Symfony\Component\Routing\Annotation\Route;
  10. class MainController extends AbstractController
  11. {
  12.     /**
  13.      * @Route("/", name="home_page", methods={"GET"})
  14.      * @param EntityManagerInterface $em
  15.      * @param DashBoardLogic $dashBoardLogic
  16.      * @return Response
  17.      */
  18.     public function index(EntityManagerInterface $emDashBoardLogic $dashBoardLogic): Response
  19.     {
  20.         return $this->render('index.html.twig', [
  21.             'chart' => [],
  22.             'exports' => $em->getRepository(Export::class)->findBy(
  23.                 ['type' => Export::TYPE_EXPORT_HOURS_STATEMENT],
  24.                 ['id' => 'DESC'], 15),
  25.             'imports' => $em->getRepository(Import::class)->findBy(
  26.                 ['type' => Import::TYPE_IMPORT_HOURS_STATEMENT],
  27.                 ['id' => 'DESC'], 15)
  28.         ]);
  29.     }
  30. }