$villages, ])); } #[Route(path: '/village/{x}/{y}', methods: ['GET'])] public function show(Request $request): Response { $village = Model::getByCoordinates($request->get('x'), $request->get('y')); $results = DB::query( <<'id')::bigint where events.village_id=:id and events.type=:type SQL, ['id' => $village->id, 'type' => 'UpgradeBuilding'] )->fetchAll(); $events = []; foreach ($results as $row) { $events[$row['type']][] = [ 'event' => DB::convertToModel(UpgradeBuilding::class, $row), 'data' => [ 'building' => $row['building'], ], ]; } return new Response(View::render('village.twig', [ 'village' => $village, 'events' => $events, ])); } }