From 56f405ff5735e4fcedcef99dbf7242858bff6de8 Mon Sep 17 00:00:00 2001 From: Jeroen van den Enden Date: Tue, 7 Nov 2023 09:44:06 +0000 Subject: [PATCH] Fix routing --- .../symfony/config/routes/endroid_soccer_calendar.yaml | 5 ++--- composer.json | 6 +++--- src/Controller/TeamCalendarController.php | 4 ---- src/Controller/TeamListController.php | 4 ---- src/Resources/config/routes.yaml | 7 +++++++ src/Resources/views/team/list.html.twig | 4 ++-- 6 files changed, 14 insertions(+), 16 deletions(-) create mode 100644 src/Resources/config/routes.yaml diff --git a/.install/symfony/config/routes/endroid_soccer_calendar.yaml b/.install/symfony/config/routes/endroid_soccer_calendar.yaml index b9d76d9..023d8c6 100644 --- a/.install/symfony/config/routes/endroid_soccer_calendar.yaml +++ b/.install/symfony/config/routes/endroid_soccer_calendar.yaml @@ -1,4 +1,3 @@ -endroid_soccer_calendar: - resource: "@EndroidSoccerCalendarBundle/Controller/" - type: annotation +endroid_data_sanitize: + resource: "@EndroidSoccerCalendarBundle/Resources/config/routes.yaml" prefix: /soccer-calendar diff --git a/composer.json b/composer.json index d4dba1a..d8a4cf9 100755 --- a/composer.json +++ b/composer.json @@ -15,9 +15,9 @@ "php": "^8.1", "endroid/installer": "^1.2.2", "endroid/soccer-calendar": "^2.2", - "symfony/dependency-injection": "^5.4||^6.0", - "symfony/http-foundation": "^5.4||^6.0", - "symfony/twig-bundle": "^5.4||^6.0" + "symfony/dependency-injection": "^5.4||^6.4||^7.0", + "symfony/http-foundation": "^5.4||^6.4||^7.0", + "symfony/twig-bundle": "^5.4||^6.4||^7.0" }, "require-dev": { "endroid/quality": "dev-master" diff --git a/src/Controller/TeamCalendarController.php b/src/Controller/TeamCalendarController.php index e4b30b6..4f166cc 100644 --- a/src/Controller/TeamCalendarController.php +++ b/src/Controller/TeamCalendarController.php @@ -10,7 +10,6 @@ use Endroid\SoccerData\Loader\GameLoaderInterface; use Endroid\SoccerData\Loader\TeamLoaderInterface; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\Routing\Annotation\Route; final class TeamCalendarController { @@ -23,9 +22,6 @@ public function __construct( ) { } - /** - * @Route("/{competitionName}/team/{teamName}.ics", name="soccer_calendar_team") - */ public function __invoke(string $competitionName, string $teamName): Response { $competition = $this->competitionLoader->loadByName($competitionName); diff --git a/src/Controller/TeamListController.php b/src/Controller/TeamListController.php index eadd147..c29decb 100644 --- a/src/Controller/TeamListController.php +++ b/src/Controller/TeamListController.php @@ -7,7 +7,6 @@ use Endroid\SoccerData\Loader\CompetitionLoaderInterface; use Endroid\SoccerData\Loader\TeamLoaderInterface; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\Routing\Annotation\Route; use Twig\Environment; final class TeamListController @@ -21,9 +20,6 @@ public function __construct( ) { } - /** - * @Route("/", name="soccer_calendar_list") - */ public function __invoke(): Response { $competitions = []; diff --git a/src/Resources/config/routes.yaml b/src/Resources/config/routes.yaml new file mode 100644 index 0000000..0a8fa42 --- /dev/null +++ b/src/Resources/config/routes.yaml @@ -0,0 +1,7 @@ +soccer_calendar_team_calendar: + path: /{competitionName}/team/{teamName}.ics + controller: Endroid\SoccerCalendarBundle\Controller\TeamCalendarController + +soccer_calendar_team_list: + path: / + controller: Endroid\SoccerCalendarBundle\Controller\TeamListController diff --git a/src/Resources/views/team/list.html.twig b/src/Resources/views/team/list.html.twig index ea62ffb..cf125cc 100644 --- a/src/Resources/views/team/list.html.twig +++ b/src/Resources/views/team/list.html.twig @@ -16,8 +16,8 @@ {% for team in competition.teams %} - {{ team.name }} - + {{ team.name }} + {% endfor %}