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
routing loader does not resolve parameters? #13793
Comments
@cordoval this is indeed a limitation of the way parameters are resolved. See symfony/symfony-docs#4207 |
@javiereguiluz the issue you linked to is about DI configuration imports. In such cases, the parameters are not yet all loaded and that means it's not possible to use them for the imports. However, when the routes are loaded, the container is full build and the parameter bag is frozen. This means it should be possible to use parameters in the imports. According to @cordoval, this feature does not yet exist. I'm not sure if I do want it to exist for routing. As it'll then confuse many people: it doesn't work and will never work for container config, but it does work for routing? |
perhaps a work around would be to include a routing.php ? i am trying to think of options as this limitation is weird, if it is possible it will enable arbitrary folders which today's development is desirable for more comfortable folder structure. |
Please note that something like this: assign_routes:
resource: "Vendor\\Application\\Frontend\\CaseManagement\\Controller\\AssignController"
type: "annotation"
prefix: /%kernel.debug%/some/path/here does work (I just tried it a few minutes ago on 2.6.4, to be sure). So, at this point, all parameters are indeed already loaded and they can be used (I also tried it with parameters that are NOT part of the kernel). (Just wanted to make sure this is known by the future people who will wander on this page...) |
This is quite a hard one to solve though. Parameters on the path (prefix) are quite simple, as they can be integrated by a router (before matching, first resolve the parameters in a path). This can be done on framework level (https://github.com/symfony/FrameworkBundle/blob/master/Routing/Router.php) and keeps the Routing component pure. However, this loading is handled by the loaders inside the Routing component. If this functionality has to be implemented there, it means the FrameworkBundle has to overwrite all file loaders in order to make them parameters aware (the import syntaxes are different per format). I'm afraid it won't be nice or very simple. Besides that, I still think that being inconsistent isn't great (not being able to use it in imports is already inconsistent, but making it possible for routing and not for DI is even more consistent). It may be clear that I'm leaning a bit towards the -1 side (fortunately for you, I don't have any voting priveleges, just wanted to share my opinion). |
thanks @SoboLAN straight to the point |
I know in DI container things such as services get resolved like with parameters %kernel.root_dir%
however on routing.yml
This needs to happen because:
wouldn't work (notice is not a bundle).
I checked on the loader but cannot see where exactly I need to wire things in order to make things work.
Is this a limitation of symfony? perhaps we can discuss ways to support this in 2.6+?
👴
The text was updated successfully, but these errors were encountered: