mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
Property promotion not working correctly with associations/proxies #7253
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @delolmo on GitHub (Nov 20, 2023).
Bug Report
Summary
I opened this #10456 in the past, hoping that it had been fixed in #10385, but I still keep getting the same error.
Given that associations are loaded through proxies, when using constructor promotion in entities, PHP will throw an error when trying to access a property of the proxy object.
Current behavior
The stated above.
How to reproduce
Given these entities (i.e.):
One would expect this code to work:
But the following error is thrown:
Expected behavior
If possible, no error should be thrown and properties should be initialized when trying to access the proxy object.
@delolmo commented on GitHub (Nov 23, 2023):
Just to continue with the example, this actually works (although it comes as no surprise):