-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Fix skipping properties if they are listed after a not loaded relation. #1387
Conversation
Hello, thank you for creating this pull request. I have automatically opened an issue http://www.doctrine-project.org/jira/browse/DDC-3699 We use Jira to track the state of pull requests and the versions they got |
This sounds like one of those fiddly edge-cases where a test may be useful. |
yeah requires a test case indeed |
I've added some tests too. Not sure if the location is appropriate, let me know and I move them. I've added them under the namespace |
…d-entities-2.5' into 2.5 Close #1387
@lenardpalko merged, thank you! |
This issue fixes an issue that occurs when merging entites, when the entity that is being merged has some other properties after a association type field.
Fixes the following scenario :
Your entity extends a parent entity and when it is merged by the entity manager first its fields are computed, this is done correctly bby
ReflectionPropertiesGetter::getProperties()
, but in themergeEntityStateIntoManagedCopy
method the iteration is stopped when it gets to a field that is a relationship and it is Proxy and was not loaded yet.The order in which the fields are computed is : current class properties and then the parent properties, so if the current class has a lazy loaded relationship then the properties of the parent are not merged.
So the fix doesn't stop the iteration it just skips the current property that is not loaded yet and goes to the next property.