orm icon indicating copy to clipboard operation
orm copied to clipboard

Fix the initialization of lazy-ghost proxies with postLoad listeners

Open stof opened this issue 1 year ago • 4 comments

PostLoad listeners might initialize values for transient properties, so the proxy should not skip initialization when using transient properties.

Closes https://github.com/doctrine/orm/issues/11524

stof avatar Jul 05 '24 12:07 stof

the failing tests are because the testsuite currently relies on unmapped public properties to track the usage of postLoad listeners. For doctrine/common proxies, public properties were unsupported and were not triggering initialization (public methods were the trigger, and using a public property was allowing to skip using any method), which was a known limitation of the proxy system (meant to be solved by the new system, among other things) For the initial implementation of the lazy-ghost proxies, mapped properties were the trigger, making those tests work as well (as those are unmapped properties). But as this PR is precisely about changing the trigger to be all properties, tests will need a different way to track usage.

stof avatar Jul 30 '24 13:07 stof

Would it make sense to do this only when there are postload listeners? Alternatively, it means we should "skip" the properties used in tests, right?

nicolas-grekas avatar Sep 24 '24 14:09 nicolas-grekas

I wanted to refactor those tests to store the initialization tracking externally, but I haven't done it yet (I kinda forgot this PR)

stof avatar Sep 24 '24 14:09 stof

/cc @priyadi

nicolas-grekas avatar Sep 24 '24 14:09 nicolas-grekas

There hasn't been any activity on this pull request in the past 90 days, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 7 days. If you want to continue working on it, please leave a comment.

github-actions[bot] avatar Dec 24 '24 03:12 github-actions[bot]

This pull request was closed due to inactivity.

github-actions[bot] avatar Jan 07 '25 03:01 github-actions[bot]

Is there perhaps an update for this issue?

dannyvw avatar Mar 11 '25 15:03 dannyvw

I haven't had the time to go back at it to update the tests. But I saw that https://github.com/doctrine/orm/pull/11853 had similar needs to update the tests, so I might be able to borrow from it.

stof avatar Mar 11 '25 17:03 stof