-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Automatically enable the routing annotation loader #23044
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
6cee255
to
f7b9a80
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does that play with framework extra bundle when installed?
*/ | ||
protected function getDefaultRouteName(\ReflectionClass $class, \ReflectionMethod $method) | ||
{ | ||
$routeName = parent::getDefaultRouteName($class, $method); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be inlined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Sensio's loaders take precedence over these new loaders because of their priority. |
f7b9a80
to
c2f796f
Compare
Thank you @GuilhemN. |
…ilhemN) This PR was merged into the 3.4 branch. Discussion ---------- Automatically enable the routing annotation loader | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | yes <!-- don't forget updating src/**/CHANGELOG.md files --> | BC breaks? | no | Deprecations? | no <!-- don't forget updating UPGRADE-*.md files --> | Tests pass? | yes | Fixed tickets | there's probably one but I didn't find it | License | MIT | Doc PR | Thanks to fqcn services, most of the time, we don't need the SensioFrameworkExtraBundle to use `@Route`. So I suggest to automatically enable it when annotations are enabled. This way we could simplify https://github.com/symfony/recipes/blob/master/symfony/framework-bundle/3.3/etc/routing.yaml#L5. Note: I added priority support for routing loaders to make sure sensio loaders are executed before ours. Commits ------- c2f796f Automatically enable the routing annotation loader
This PR was merged into the 3.4 branch. Discussion ---------- [FrameworkBundle] Fix colliding service ids | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | Rereading #23044, I realized that `routing.loader.directory` is already used, so it should be changed. Commits ------- a4d799a [FrameworkBundle] Fix colliding service ids
…dle since 3.4 (GuilhemN) This PR was submitted for the master branch but it was merged into the 3.4 branch instead (closes #8016). Discussion ---------- [Routing] `@Route` is usable without SensioFrameworkBundle since 3.4 Since symfony/symfony#23044, annotation routes are supported by the framework bundle. So I think we should push using the annotation of the Routing component instead of the one of SensioFrameworkExtraBundle. Commits ------- c0e466a [Routing] is usable without SensioFrameworkBundle since 3.4
…favor of Symfony Core (Tobion) This PR was merged into the 5.1.x-dev branch. Discussion ---------- Deprecate routing annotation of FrameworkExtraBundle in favor of Symfony Core Since symfony/symfony#23044 routing annotation is part of Symfony Core. The only extra features that the routing annotation from SensioFrameworkExtraBundle has are - service config for `@Route` which we don't need anymore - Either you use class-named services, then you don't need the "service" property at all. - Or you don't use class-named services. In this case the better solution to me, is for people to create a alias in the container from the controller class to to service id instead of specifying the service id in the routing. Then you're set as well and that is already common practice with autowiring. - `@Method` does not provide real value as people agree in symfony/symfony#25103 This resolves symfony/symfony#25103 Commits ------- 444683c Deprecate routing annotation of FrameworkExtraBundle in favor of Symfony Core
Thanks to fqcn services, most of the time, we don't need the SensioFrameworkExtraBundle to use
@Route
.So I suggest to automatically enable it when annotations are enabled. This way we could simplify https://github.com/symfony/recipes/blob/master/symfony/framework-bundle/3.3/etc/routing.yaml#L5.
Note: I added priority support for routing loaders to make sure sensio loaders are executed before ours.