-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Routing] Fix "config-file-relative" annotation loader resources #25113
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
Conversation
See symfony/recipes#272 for a corresponding recipe (verified locally.) |
Note that it would be great to deprecate using the |
2ca0359
to
289a000
Compare
Can you add some tests for that? |
This one makes is difficult (read impossible) to have a config that works on 3.3 and 3.4/4.0 (cf. the changed recipe). |
The current config that works will continue to work. I'm now rebasing on 3.3 as bug fix, so that Flex+3.3 can get the good DX config. |
289a000
to
5998e9d
Compare
rebased on 3.3 |
And we even have tests now 👍 |
Thank you @sroze. |
…ources (nicolas-grekas, sroze) This PR was merged into the 3.3 branch. Discussion ---------- [Routing] Fix "config-file-relative" annotation loader resources | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | slight behavior change | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - By using the locator in its `supports()` method, the `AnnotationDirectoryLoader` breaks config-relative annotation resources. The workaround is to fallback on `kernel.root_dir`-relative paths, as done in https://github.com/symfony/recipes/blob/master/doctrine/annotations/1.0/config/routes/annotations.yaml But as you can see, this is rather WTF: extra knowledge is required to know what to type there. All the other loader look relatively to the config file first. This is a bug, but since this is a slight behavior change, I think it's best to merge it on 3.4. Commits ------- f4999d8 Add tests proving it can load annotated files 5998e9d [Routing] Fix "config-file-relative" annotation loader resources
By using the locator in its
supports()
method, theAnnotationDirectoryLoader
breaks config-relative annotation resources. The workaround is to fallback onkernel.root_dir
-relative paths, as done in https://github.com/symfony/recipes/blob/master/doctrine/annotations/1.0/config/routes/annotations.yamlBut as you can see, this is rather WTF: extra knowledge is required to know what to type there. All the other loader look relatively to the config file first.
This is a bug, but since this is a slight behavior change, I think it's best to merge it on 3.4.