Open LIVID-Media opened 8 months ago
Fixed in 5.0.0
👍
Thanks for the quick investigation of the problem. Unfortunately I still get the error by activating it in a news archive:
Symfony\Cmf\Component\Routing\Event\RouterGenerateEvent::setRoute(): Argument #1 ($route) must be of type string, Contao\CoreBundle\Routing\Page\PageRoute given, called in vendor\fritzmg\contao-simple-news-urls\src\EventListener\RouterGenerateEventListener.php on line 70
The previous version of @symfony-cmf (2.1) still accepted strings and objects for $event->setRoute($route). The current master version (3.0), however, only accepts strings.
Can you provide a PR with the necessary fixes?
I would like to help, but unfortunately I wasn't able to fix it until now.
By installing over the Contao Manager there are two Fatal errors:
Declaration of InspiredMinds\ContaoSimpleNewsUrls\Routing\RouteProvider::getRouteCollectionForRequest() must be compatible with Symfony\Cmf\Component\Routing\RouteProviderInterface::getRouteCollectionForRequest(Symfony\Component\HttpFoundation\Request $request): Symfony\Component\Routing\RouteCollection in C:\UwAmp\www\contao5\vendor\fritzmg\contao-simple-news-urls-bundle\src\Routing\RouteProvider.php on line 38
Declaration of InspiredMinds\ContaoSimpleNewsUrls\Routing\RouteProvider::getRoutesByNames($names): array must be compatible with Symfony\Cmf\Component\Routing\RouteProviderInterface::getRoutesByNames(?array $names = null): Traversable|array in C:\UwAmp\www\contao5\vendor\fritzmg\contao-simple-news-urls-bundle\src\Routing\RouteProvider.php on line 89
I installed it manually and changed the following lines in src/Routing/RouteProvider.php
line 37:
public function getRouteCollectionForRequest(Request $request) to public function getRouteCollectionForRequest(Request $request): RouteCollection
line 89:
public function getRoutesByNames($names): array to public function getRoutesByNames(?array $names = null): array
But now there is another issue in src/EventListener/RouterGenerateEventListener.php that I can't fix
Symfony\Cmf\Component\Routing\Event\RouterGenerateEvent::setRoute(): Argument #1 ($route) must be of type string, Contao\CoreBundle\Routing\Page\PageRoute given, called in ...\src\EventListener\RouterGenerateEventListener.php on line 70