Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Router][DX] Relative resource references should resolve against the config file's location #24982

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

Closed
backbone87 opened this issue Nov 15, 2017 · 3 comments
Labels
DX DX = Developer eXperience (anything that improves the experience of using Symfony) Routing

Comments

@backbone87
Copy link
Contributor

When using relative route resource references, these references are resolved against the kernel root dir and not like all other config files against the file's location itself.
This is also mentioned in the ticket implementing relative route resource references: #21231 (comment)

This is especially painful because using file relative references sometimes work:

app:
    resource: ../../src/Action/
    type:     annotation

This config works for me in one project, but in another project, i had to use:

app:
    resource: Action/
    type:     annotation

And i dont know why it works in one and not the other, both use the 3.4-BETA2 and are bundle less apps with kernel at /src/Kernel.php and config file at /etc/_common/_routing.yml

@xabbuh xabbuh added the Routing label Nov 15, 2017
@javiereguiluz javiereguiluz added the DX DX = Developer eXperience (anything that improves the experience of using Symfony) label Nov 19, 2017
@nicolas-grekas
Copy link
Member

It should, but unfortunately it would be a BC break to change this behavior.
We must find a continuous migration path if we want to fix this...

@backbone87
Copy link
Contributor Author

backbone87 commented Nov 25, 2017

One idea that comes to my mind is using the same loader mechanism for routes, as for the DI container and let a bundle pass it to the route loader somehow. this would be an additional way to load routes and not a replacement. That way we can change the way the default recipe of the framework bundle loads routes for a soft migration:

  • "deprecate" config/routes and move them to config/packages and the current implementation of the Kernels configureRoutes (not the method itself, just the content)
  • let the framework bundle somehow pass the routes configuration array (loaded via DI loader) to the route loader.

@nicolas-grekas
Copy link
Member

Actually, this has been fixed in #25113

@backbone87 that's a totally different story, not sure about it.

Closing here, as the reported issue is gone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DX DX = Developer eXperience (anything that improves the experience of using Symfony) Routing
Projects
None yet
Development

No branches or pull requests

4 participants