src/Controller/StationListController.php line 24

Open in your IDE?
  1. <?php
  2. /**
  3.  * Created by simpson <simpsonwork@gmail.com>
  4.  * Date: 2019-04-15
  5.  * Time: 12:27
  6.  */
  7. namespace App\Controller;
  8. use App\Entity\Location\City;
  9. use App\Service\EntitySortService;
  10. use App\Service\LocationsProfileCounters;
  11. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  12. use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
  13. use Flagception\Bundle\FlagceptionBundle\Annotations\Feature;
  14. use Symfony\Component\HttpFoundation\Response;
  15. class StationListController extends AbstractController
  16. {
  17.     /**
  18.      * @Feature("has_station_list_page")
  19.      */
  20.     #[ParamConverter("city"converter"city_converter")]
  21.     public function page(City $cityEntitySortService $sortServiceLocationsProfileCounters $locationsProfileCounters): Response
  22.     {
  23.         $countByStations $locationsProfileCounters->getCountByStations();
  24.         return $this->render('StationList/list.html.twig', [
  25.             'city' => $city,
  26.             'stations' => $sortService->sortEntityArrayByTranslatableFieldName($city->getStations()->toArray(), 'name'),
  27.             'count_by_stations' => $countByStations,
  28.         ]);
  29.     }
  30. }