Open pounard opened 1 year ago
After some random searches on the internet I found this https://stackoverflow.com/questions/71530777/how-do-i-change-a-readonly-property-using-reflection-in-php-8-1 which points to https://3v4l.org/mis1l#v8.1.0
I don't like this ugly hack but in the end, the generated hydrator is using the very ulgy closure hack itself, and implementation won't matter for users, as soon as it works as expected.
Should I attempt an implementation of this ?
And done, cf. linked PR.
It seems very normal in the end, since that readonly properties can only be initialized from constructor, but since I mostly bypass constructors to hydrate all object values at once, I end up on this error:
I wonder if there's a trick to bypass this ?