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

Routing page suggest installing SensioFrameworkExtraBundle while Doctrine Annotations suffices #10426

Closed
aadmathijssen opened this issue Oct 2, 2018 · 5 comments

Comments

@aadmathijssen
Copy link

The first instruction on the Routing page (routing.rst) is to install the annotations Composer package, which turns out to be an alias for sensio/framework-extra-bundle.

However, in several places (see also sensiolabs/SensioFrameworkExtraBundle#562 and sensiolabs/SensioFrameworkExtraBundle#585) it is mentioned that routing via annotations is part of Symfony core since version 3.4, and that the SensioFrameworkExtraBundle is not needed anymore.

However, when I don't require the Composer package/alias, I get the following error:

Cannot load resource "../../src/Controller/". Make sure annotations are installed and enabled.

After trying several things and almost giving up, I discovered that installing the doctrine/annotations Composer package did the trick.

I think it's better to change the documentation of the routing page such that doctrine/annotations is mentioned instead of annotations.

@javiereguiluz
Copy link
Member

You are right about this. However, the framework-extra-bundle package provides lots of other annotations besides @Route. Some of them are used in other parts of the code, so I think it's better to keep installing support for all these annotations instead of only installing support for @Route.

There's an open issue (symfony/symfony#25361) to move ALL annotations into Symfony core. If we do that, then we'll update the docs as you say, because there will be no need install this bundle.

That's why I'm closing this issue for now as "won't fix" ... but we appreciate that you created it and we thank you for helping us improve the docs. Thanks!

@aadmathijssen
Copy link
Author

OK, but to avoid confusion, isn't it better to replace the annotations alias by the real package name sensio/framework-extra-bundle?

That would have saved me time and would not have caused confusion.

I see that this is already proposed in #9742, but that PR doesn't seem to be merged?

@javiereguiluz
Copy link
Member

We did it like this because "composer require annotations" is something easy to understand ... but "composer require sensio/framework-extra-bundle" is not that easy ("sensio": who or what is that?, "extra bundle": extra what? where are my annotations? etc.)

@aadmathijssen
Copy link
Author

For me it was harder to understand than easier.

Nowhere on the page it is stated that annotations is a Symfony Flex alias, so I didn't know I was dealing with one. Before I discovered this, I was asking myself the following questions:

  • Why on earth would Composer want to install sensio/framework-extra-bundle while I only told it to install annotations?
  • Why does Composer install all these Doctrine packages like doctrine/persistence while I'm building a headless application without any local database?
  • Why does composer why sensio/framework-extra-bundle states that my project itself needs it, while I didn't give the command to install it?
  • Why does composer why annotations give an InvalidArgumentException with the message Could not find package "annotations" in your project"?

@MatTheCat
Copy link
Contributor

@javiereguiluz as RFC on the subjet will probably take some time can I open a PR to address this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants