Collections, relations, typed properties and constructor assignment #8833
Unanswered
pkly
asked this question in
Support Questions
Replies: 2 comments 3 replies
-
Please make sure you use an up-to-date version of |
Beta Was this translation helpful? Give feedback.
2 replies
-
This should work, it sounds like a bug. The |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I have a question about collections.
Assuming a ManyToMany or OneToMany relation between entities, one would create something like the following
And this works fine, assuming you create the entity.
Something weird happens however if you assume the following scenario.
In some scenarios accessing a field which is a multiple relation will try to access the field itself, which is not initialized and causes a crash. Why is that? Why do doctrine devs recommend creating collections in the constructor if it's not even fired during load from database? How should this be handled properly? Via the PostLoad hook and creating an empty collection?
Using doctrine/orm 2.9.3
Beta Was this translation helpful? Give feedback.
All reactions