Skip to content
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

Automatically enable the routing annotation loader #23044

Merged
merged 1 commit into from Jun 9, 2017

Conversation

GuilhemN
Copy link
Contributor

@GuilhemN GuilhemN commented Jun 2, 2017

Q A
Branch? 3.4
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
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.

@GuilhemN GuilhemN changed the base branch from master to 3.4 June 2, 2017 18:09
@nicolas-grekas nicolas-grekas added this to the 3.4 milestone Jun 3, 2017
Copy link
Member

@fabpot fabpot left a 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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be inlined

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@GuilhemN
Copy link
Contributor Author

GuilhemN commented Jun 7, 2017

How does that play with framework extra bundle when installed?

Sensio's loaders take precedence over these new loaders because of their priority.
To avoid having useless services in the container we could remove these new services in SensioFrameworkExtraBundle but that's not a requirement.

@fabpot
Copy link
Member

fabpot commented Jun 9, 2017

Thank you @GuilhemN.

@fabpot fabpot merged commit c2f796f into symfony:3.4 Jun 9, 2017
fabpot added a commit that referenced this pull request Jun 9, 2017
…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
@GuilhemN GuilhemN deleted the annotated-routes branch June 9, 2017 04:10
fabpot added a commit that referenced this pull request Jun 12, 2017
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
xabbuh added a commit to symfony/symfony-docs that referenced this pull request Jul 4, 2017
…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
This was referenced Oct 18, 2017
fabpot added a commit to sensiolabs/SensioFrameworkExtraBundle that referenced this pull request Feb 24, 2018
…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
artem0723 pushed a commit to artem0723/React-Clothing-Shop that referenced this pull request Aug 27, 2021
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants