37 lines
1.1 KiB
PHP
37 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Controller;
|
|
|
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
use Symfony\Component\Routing\Annotation\Route;
|
|
use Symfony\Component\Filesystem\Filesystem;
|
|
use App\Motion\SnapshotRepository;
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
use App\Repository\TemperatureRepository;
|
|
use App\Repository\HygrometryRepository;
|
|
|
|
class MonitoringController extends AbstractController
|
|
{
|
|
/**
|
|
* @Route("/", name="charts")
|
|
*/
|
|
public function charts(): Response
|
|
{
|
|
return $this->render('charts.html.twig');
|
|
}
|
|
|
|
/**
|
|
* @Route("/datas", name="datas")
|
|
*/
|
|
public function datas(TemperatureRepository $temperatureRepository, HygrometryRepository $hygrometryRepository): Response
|
|
{
|
|
$from = new \DateTime('now - 1 day');
|
|
$to = new \DateTime('now');
|
|
|
|
return $this->render('datas.html.twig', [
|
|
'temperatures' => $temperatureRepository->findByDateRange($from, $to, 100, 'DESC'),
|
|
'hygrometries' => $hygrometryRepository->findByDateRange($from, $to, 100, 'DESC'),
|
|
]);
|
|
}
|
|
}
|