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

Bundle cannot be used without Doctrine Annotations #2143

Closed
derrabus opened this issue Nov 7, 2023 · 8 comments · Fixed by #2164
Closed

Bundle cannot be used without Doctrine Annotations #2143

derrabus opened this issue Nov 7, 2023 · 8 comments · Fixed by #2164

Comments

@derrabus
Copy link
Contributor

derrabus commented Nov 7, 2023

Symfony's FrameworkBundle automatically integrates Doctrine annotations by exposing an annotation.reader service that this bundle consumes. However, it is possible to disable that integration:

framework:
    annotations: false

If I do that, the container won't compile anymore:

The service "nelmio_api_doc.model_describers.object" has a dependency on a non-existent service "annotations.reader".

Modern Symfony 6 projects would rather use PHP attributes than Doctrine Annotations, so enabling the annotations integration isn't really necessary anymore. NelmioApiDocBundle could not use the annotations reader for anything in such a scenario because there are no annotations it could read from.

Symfony 6.4 triggers a deprecation if the annotations integration is enabled and Symfony 7 simply won't provide that service anymore.

NelmioApiDocBundle should continue to work if I disable the integration of Doctrine Annotations. In that case, Doctrine-style annotations would not be taken into account anymore. Furthermore, NelmioApiDocBundle should not list Doctrine Annotations as a mandatory dependency anymore. Applications that still use Doctrine Annotations should directly depend on that library instead.

@DavidGarciaCat
Copy link

Just speaking loudly, as I am not sure... Working on a Symfony 6.3 project where all the Controller's Routes and OpenAPI details are defined as Attributes (not annotations) seem to work. Can we expect this setting to cause a significant problem? Can't it just be detached from the Framework configuration file that manages the annotations?

@derrabus
Copy link
Contributor Author

I don't understand your question, I'm afraid.

RobertMe added a commit to RobertMe/NelmioApiDocBundle that referenced this issue Nov 23, 2023
RobertMe added a commit to RobertMe/NelmioApiDocBundle that referenced this issue Nov 23, 2023
RobertMe added a commit to RobertMe/NelmioApiDocBundle that referenced this issue Nov 23, 2023
@hamza-grichi
Copy link

Hello
I have the same problem when migrate to Symfony 6.4

The service "nelmio_api_doc.model_describers.object" has a dependency on a non-existent service "annotations.reader".

and when i put in my config
framework:
annotations: true

It works, but i have a notice : doctrine annotation reader is deprecated ⚠️

Any solution ?
Thanks

@shakaran
Copy link
Contributor

shakaran commented Dec 7, 2023

Could we progress with the PR #2151 and release a new version at least in master?

@denisvanmorgan
Copy link

hi, any updates on this?

@faizanakram99
Copy link
Contributor

faizanakram99 commented Dec 9, 2023

i am working on this

nvm, saw there is already a PR

@killerwolf
Copy link

killerwolf commented Dec 13, 2023

i am facing the same issue when upgrading to symfony 6.4,
activating annotations in the framework bundle is mandatory is the only option

@zenoleg
Copy link

zenoleg commented Feb 5, 2024

Yep, faced the same problem with NelmioApiDoc and just downloaded the doctrine/annotations + turned on the 'annotations' option in framework bundle

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

Successfully merging a pull request may close this issue.

8 participants