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

Inject an AttributeReader when annotations are disabled #486

Merged
merged 1 commit into from
Jun 10, 2024

Conversation

stof
Copy link
Owner

@stof stof commented Jun 10, 2024

This avoids triggering the fallback path of instantiating an (uncached) annotation reader in the extensions in case annotations are disabled in FrameworkBundle but the doctrine/annotations package is still installed.

Closes #481

This avoids triggering the fallback path of instantiating an (uncached)
annotation reader in the extensions in case annotations are disabled in
FrameworkBundle but the `doctrine/annotations` package is still
installed.
@stof stof merged commit 473ae65 into main Jun 10, 2024
18 checks passed
@stof stof deleted the inject_attribute_reader branch June 10, 2024 12:27
@igordeveloper
Copy link

@stof ,

Could you please help with a doubt?

Is there a way to tell whether I can choose annotations or attributes? If I have another bundle that still injects the annotations reader into the container, will stof instantiate annotations reader as default?

Are there any other releases that already make this possible?

thank you so much

@stof
Copy link
Owner Author

stof commented Oct 23, 2024

This bundle does not instantiate an annotation reader. It uses the annotation_reader service if it exists in the container.

However, note that enabling the support of annotations does not disable support for attributes. The Gedmo extensions support attributes all the time on PHP 8+.

@igordeveloper
Copy link

igordeveloper commented Oct 23, 2024

This bundle does not instantiate an annotation reader. It uses the annotation_reader service if it exists in the container.

However, note that enabling the support of annotations does not disable support for attributes. The Gedmo extensions support attributes all the time on PHP 8+.

Yes, i'm using attributes with Gedmo,
My question is relationed the deprecation message:

Annotations support is deprecated, migrate your application to use attributes and pass an instance of Gedmo\Mapping\Driver\AttributeReader

My project there annotation_reader active in the container yet, Is there any way to not use the annotation_reader without the search being through the container?

Thank you for the feedback.

@stof
Copy link
Owner Author

stof commented Oct 23, 2024

@igordeveloper if you cannot disable the support of annotations from the FrameworkBundle configuration (because something still needs annotations in your project), no.
Note that FrameworkBundle supports disabling the support for annotations (thus not defining the annotation_reader service) even if doctrine/annotations is still installed (it will enable annotations by default based on the presence of the package, but you can always set an explicit enabled: false)

@igordeveloper
Copy link

igordeveloper commented Oct 23, 2024

@igordeveloper if you cannot disable the support of annotations from the FrameworkBundle configuration (because something still needs annotations in your project), no. Note that FrameworkBundle supports disabling the support for annotations (thus not defining the annotation_reader service) even if doctrine/annotations is still installed (it will enable annotations by default based on the presence of the package, but you can always set an explicit enabled: false)

Yes, i have disabled in the framework, but unfortunately I have 2 packages using still annotations.

Thanks for the answer and you time.

@stof
Copy link
Owner Author

stof commented Oct 23, 2024

If it is disabled in the framework, this PR should be solving the deprecation you report (assuming you use this bundle to configure the Gedmo listeners of course. If you configure them yourselves, there is no point commenting on this bundle at all)

@igordeveloper
Copy link

If it is disabled in the framework, this PR should be solving the deprecation you report (assuming you use this bundle to configure the Gedmo listeners of course. If you configure them yourselves, there is no point commenting on this bundle at all)

I will check if i disable correclty,
Yes, i use this bundle to configure Gedmo Listeners.

thank you.

@igordeveloper
Copy link

@stof

thank you for the help.

The problem with annotation deprecations was solved here.

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 this pull request may close these issues.

Inject the attribute reader in place of the annotations reader when able
2 participants