add db and fixtures

This commit is contained in:
Tykayn 2025-05-26 11:32:53 +02:00 committed by tykayn
parent 03f53f4688
commit 528ebb672a
20 changed files with 1655 additions and 116 deletions

View file

@ -2,6 +2,9 @@
namespace App\Controller;
use App\Entity\Stats;
use App\Entity\Place;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
@ -13,6 +16,11 @@ class PublicController extends AbstractController
private $mapbox_token = 'BVM2NRJuzQunWvXbTnzg';
private $maptiler_token = 'BVM2NRJuzQunWvXbTnzg';
public function __construct(
private EntityManagerInterface $entityManager
) {
}
public function get_osm_object_data($osm_object_id = 12855459190)
{
@ -45,7 +53,7 @@ class PublicController extends AbstractController
];
// Récupérer les vraies données OSM
$client = new \GuzzleHttp\Client();
$client = new Client();
try {
$response = $client->get($object_id);
$xml = simplexml_load_string($response->getBody()->getContents());
@ -89,6 +97,19 @@ class PublicController extends AbstractController
]);
}
#[Route('/dashboard', name: 'app_public_dashboard')]
public function dashboard(): Response
{
// get stats
$stats = $this->entityManager->getRepository(Stats::class)->findAll();
$places = $this->entityManager->getRepository(Place::class)->findAll();
return $this->render('public/dashboard.html.twig', [
'controller_name' => 'PublicController',
'stats' => $stats,
'places' => $places,
]);
}
#[Route('/modify/{osm_object_id}/{version}/{changesetID}', name: 'app_public_submit')]
public function submit($osm_object_id, $version, $changesetID): Response
{