Skip to content

Fix setParameter for RouteCollection in Create Framework tutorial #20928

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

Open
wants to merge 1 commit into
base: 6.4
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions create_framework/dependency_injection.rst
Original file line number Diff line number Diff line change
Expand Up @@ -227,16 +227,16 @@ object::
$container->setParameter('charset', 'UTF-8');

Instead of relying on the convention that the routes are defined by the
``$routes`` variables, let's use a parameter again::
``$routes`` variables, let's use a reference::

// ...
$container->register('matcher', Routing\Matcher\UrlMatcher::class)
->setArguments(['%routes%', new Reference('context')])
->setArguments([new Reference('routes'), new Reference('context')])
;

And the related change in the front controller::

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

We have barely scratched the surface of what you can do with the
container: from class names as parameters, to overriding existing object
Expand Down