Skip to content

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

Open
@techware01

Description

@techware01

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    RoutinghasPRA Pull Request has already been submitted for this issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions