<?php
/**
* Created by simpson <simpsonwork@gmail.com>
* Date: 2019-04-15
* Time: 12:27
*/
namespace App\Controller;
use App\Entity\Location\City;
use App\Service\EntitySortService;
use App\Service\LocationsProfileCounters;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Flagception\Bundle\FlagceptionBundle\Annotations\Feature;
use Symfony\Component\HttpFoundation\Response;
class StationListController extends AbstractController
{
/**
* @Feature("has_station_list_page")
*/
#[ParamConverter("city", converter: "city_converter")]
public function page(City $city, EntitySortService $sortService, LocationsProfileCounters $locationsProfileCounters): Response
{
$countByStations = $locationsProfileCounters->getCountByStations();
return $this->render('StationList/list.html.twig', [
'city' => $city,
'stations' => $sortService->sortEntityArrayByTranslatableFieldName($city->getStations()->toArray(), 'name'),
'count_by_stations' => $countByStations,
]);
}
}