Skip to content

stop using the deprecated @method annotation #10150

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

Merged
merged 1 commit into from
Sep 7, 2018

Conversation

xabbuh
Copy link
Member

@xabbuh xabbuh commented Aug 3, 2018

I think we should use the @Route annotation from the Routing component instead of the one from SensioFrameworkExtraBundle (fixes #10142).

@xabbuh xabbuh added this to the 2.8 milestone Aug 3, 2018
@GuilhemN
Copy link
Contributor

GuilhemN commented Aug 5, 2018

Maybe it would be simpler to cherry pick #8016?

Some changes are missing imo, like https://github.com/symfony/symfony-docs/pull/8016/files#diff-8dd5da38c8cf3dec783e2e5247682043L130, https://github.com/symfony/symfony-docs/pull/8016/files#diff-54df5b9457e71c9f4a6cd1e3522a12c1R194, but globally this is a good move 👍

@xabbuh
Copy link
Member Author

xabbuh commented Aug 7, 2018

@GuilhemN Ah, I forgot that we already made the change for the 3.4 docs in the past.

@HeahDude @javiereguiluz @weaverryan @wouterj Do you agree with backporting #8016?

@javiereguiluz
Copy link
Member

I don't remember why we didn't that change in 2.8. Maybe the merge was too conflicting or maybe we prefer to keep that old doc related to the old SensioFrameworkExtraBundles? After all, if you are reading Symfony 2.8 docs today, you are probably working on a legacy app, so I'm not sure if the new ExtraBundle version is going to be available.

@xabbuh
Copy link
Member Author

xabbuh commented Aug 7, 2018

The only use case where you need the @Route annotation from FrameworkExtraBundle` with Symfony 2.8 is when configuring controllers as services. But in http://symfony.com/doc/2.8/controller/service.html we even do not show such an example. Though we could expand the tipp there if we decide to backport #8016.

I think the reason we did this change only for 3.4+ was that this was the first version where even using controllers as services with the built-in @Route annotation was easily doable.

@weaverryan
Copy link
Member

I'm confused: in #8016, we made the change because this was a new feature added to Symfony 3.4. Does it work on 2.8?

Also, in the original issue - #10142, the user IS using Symfony 3.4. The real problem was that the deprecation notice wasn't obvious:

User Deprecated: The "Sensio\Bundle\FrameworkExtraBundle\Configuration\Method" annotation is deprecated since version 5.2. Use "Symfony\Component\Routing\Annotation\Route" instead.

The user wasn't sure what happened to @Method and how to make it work with the new @Route.

Or, did I miss something? :)

@xabbuh
Copy link
Member Author

xabbuh commented Sep 3, 2018

I was confused too so I took another look. We can indeed not use the @Route annotation from the component in Symfony 2.8 as there is no class able to load the routes. But we could indeed remove the @Method annotation IMO. I am going to update the PR later today.

@xabbuh xabbuh changed the title prefer @Route annotation from Routing component stop using the deprecated @method annotation Sep 7, 2018
@xabbuh
Copy link
Member Author

xabbuh commented Sep 7, 2018

updated here to only replace usages of the @Method annotation

@javiereguiluz
Copy link
Member

Thanks Christian.

@javiereguiluz javiereguiluz merged commit 4e1496d into symfony:2.8 Sep 7, 2018
javiereguiluz added a commit that referenced this pull request Sep 7, 2018
This PR was merged into the 2.8 branch.

Discussion
----------

stop using the deprecated @method annotation

I think we should use the `@Route` annotation from the Routing component instead of the one from SensioFrameworkExtraBundle (fixes #10142).

Commits
-------

4e1496d stop using the deprecated @method annotation
@xabbuh xabbuh deleted the issue-10142 branch September 7, 2018 10:36
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.

5 participants