<?php
namespace App\Controller;
use App\Entity\Device;
use App\Entity\Exercise;
use App\Entity\Holder;
use App\Entity\Organisation;
use App\Entity\Pose;
use App\Entity\Rom;
use App\Entity\User;
use App\Entity\DataVersion;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
#[Route('/admin')]
class DashboardController extends AbstractController
{
#[Route('/', name: 'app_dashboard')]
public function index(EntityManagerInterface $em): Response
{
return $this->render('dashboard/index.html.twig', [
'exercises' => [
'count' => $em->getRepository(Exercise::class)->getEntriesCount(),
],
'users' => [
'count' => $em->getRepository(User::class)->getEntriesCount(),
],
'dataVersion' => $em->getRepository(DataVersion::class)->findOneBy([], ['id' => 'ASC'])->getVersionCounter(),
'devices' => $em->getRepository(Device::class)->findAll()
]);
}
}