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

do not rely on annotations to use attributes #1357

Merged
merged 1 commit into from
Feb 27, 2023

Conversation

garak
Copy link
Collaborator

@garak garak commented Feb 5, 2023

Fix #1344

src/DependencyInjection/VichUploaderExtension.php Outdated Show resolved Hide resolved
@@ -58,7 +59,7 @@
"symfony/yaml": "^5.4 || ^6.0"
},
"suggest": {
"doctrine/annotations": "If your project use doctrine-bundle:>=2.8, this package is required to use annotations or attributes",
"doctrine/annotations": "If you use doctrine/doctrine-bundle >2.7, this package is required to use annotations",
Copy link
Contributor

Choose a reason for hiding this comment

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

Incorrect wording here - the package is required to use annotations and attributes - not just annotations.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

the purpose of this PR is indeed allowing the use of attributes without relying on doctrine annotations

@@ -138,16 +140,22 @@ protected function registerAnnotationStrategy(ContainerBuilder $container, array
}

switch ($config['metadata']['type']) {
case 'attribute':
case 'annotation':
Copy link
Contributor

Choose a reason for hiding this comment

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

This does not resolve the issue because this bundle's attribute reader requires Doctrine\Common\Annotations\Reader which is part of doctrine/annotations.

With this PR, when using attributes the following error is now thrown in src/Metadata/Driver/AttributeReader.php (line 15):

Attempted to load interface "Reader" from namespace "Doctrine\Common\Annotations".
Did you forget a "use" statement for "Symfony\Component\CssSelector\Parser\Reader"?

Screenshot from 2023-02-06 12-35-20

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It should be working now

Copy link
Contributor

Choose a reason for hiding this comment

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

This seems to be working for attributes 👍

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This seems to be working for attributes +1

thank you for checking. Do you have the possibility to check it for annotations too? It would be awesome

@garak garak merged commit 6ee998d into dustin10:master Feb 27, 2023
@garak garak deleted the fix-attribute-annotation branch February 27, 2023 16:38
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.

Broken metadata when updated Doctrine to 2.8.0
2 participants