Why does switching from annotation to attribute disables tagging and service creation for entities #61124
Unanswered
s-bernstein
asked this question in
Q&A
Replies: 1 comment 7 replies
-
Doctrine entities have been excluded from the container by #59987 (amongst others) because they are not services. What is your use-case? |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm in the process of updating a product to Symfony 6.4 from Symfony 5.4. Now I have a rather curious behaviour that I can't explain.
This product uses some tagged iterators to collect declared classes. Some of theses classes are doctrine entities. All of this works fine in 5.4 and 6.4, if I'm using annotations to mark the entity
@ORM\Entity
. The class is tagged and the tagged iterator works as expected. Also, automatically or manually declared services will work.The moment I switch to attribute
#[ORM\Entity]
none of this works any more. Services are not created, the class is not tagged and ultimately it is missing in the tagged iterator. I also tried to useAutoconfigureTag
attribute to no avail. And it is only theEntity
attribute. I can use all other attributes in the entity and just set theEntity
via annotation and it works as expected.Am I doing something wrong? Is this behaviour intended? I couldn't find any documentation for this.
Beta Was this translation helpful? Give feedback.
All reactions