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

Incorrect Usage of setParameter for RouterCollection in "Create Framework" Tutorial #20823

Open
techware01 opened this issue Mar 25, 2025 · 0 comments

Comments

@techware01
Copy link

techware01 commented Mar 25, 2025

I am following the "Create Framework" tutorial, specifically the section on "The DependencyInjection Component." I encountered an issue with the following line of code:

$container->setParameter('routes', include __DIR__.'/../src/app.php');

This line attempts to set a RouterCollection as a parameter, which results in an error:

PHP Fatal error:  Uncaught TypeError: Symfony\Component\DependencyInjection\Container::setParameter(): Argument #2 ($value) must be of type UnitEnum|array|string|int|float|bool|null, Symfony\Component\Routing\RouteCollection given, called in /web/front.php

In my understanding as such this method of using routes in the DI container is not possible.

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

1 participant