src/Controller/DashboardController.php line 22

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\Device;
  4. use App\Entity\Exercise;
  5. use App\Entity\Holder;
  6. use App\Entity\Organisation;
  7. use App\Entity\Pose;
  8. use App\Entity\Rom;
  9. use App\Entity\User;
  10. use App\Entity\DataVersion;
  11. use Doctrine\ORM\EntityManagerInterface;
  12. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  13. use Symfony\Component\HttpFoundation\Response;
  14. use Symfony\Component\Routing\Annotation\Route;
  15. #[Route('/admin')]
  16. class DashboardController extends AbstractController
  17. {
  18.     #[Route('/'name'app_dashboard')]
  19.     public function index(EntityManagerInterface $em): Response
  20.     {
  21.         return $this->render('dashboard/index.html.twig', [
  22.             'exercises' => [
  23.                 'count' =>  $em->getRepository(Exercise::class)->getEntriesCount(),
  24.             ],
  25.             'users' => [
  26.                 'count' =>  $em->getRepository(User::class)->getEntriesCount(),
  27.             ],
  28.             'dataVersion' => $em->getRepository(DataVersion::class)->findOneBy([], ['id' => 'ASC'])->getVersionCounter(),
  29.         'devices' => $em->getRepository(Device::class)->findAll()
  30.         ]);
  31.     }
  32. }