Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal error by installing on Contao 5.2.7 #20

Open
LIVID-Media opened this issue Jan 4, 2024 · 4 comments
Open

Fatal error by installing on Contao 5.2.7 #20

LIVID-Media opened this issue Jan 4, 2024 · 4 comments

Comments

@LIVID-Media
Copy link

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

@fritzmg
Copy link
Owner

fritzmg commented Jan 9, 2024

Fixed in 5.0.0 👍

@fritzmg fritzmg closed this as completed Jan 9, 2024
@LIVID-Media
Copy link
Author

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.

@fritzmg
Copy link
Owner

fritzmg commented Jan 11, 2024

Can you provide a PR with the necessary fixes?

@fritzmg fritzmg reopened this Jan 11, 2024
@LIVID-Media
Copy link
Author

I would like to help, but unfortunately I wasn't able to fix it until now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants