Skip to content
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: non-managed properties should trigger proxy load #11606

Closed
wants to merge 7 commits into from

Conversation

priyadi
Copy link

@priyadi priyadi commented Sep 20, 2024

After the move to lazy ghost, properties not managed by Doctrine no longer trigger proxy initialization.

This new behavior impacts things like file uploads that rely on postLoad event handler. Accessing a file upload property does not trigger the load, so the upload property is incorrectly null, unless the consumer first triggers the load by accessing another property first (or explicitly call __load).

This PR restores the behavior of legacy proxy, and should resolve the aforementioned issue.

@priyadi priyadi marked this pull request as draft September 20, 2024 05:32
@priyadi priyadi marked this pull request as ready for review September 20, 2024 05:52
@priyadi
Copy link
Author

priyadi commented Sep 20, 2024

I need some input from maintainers. The change breaks a lot of tests. the problem is that accessing test properties ($var->postLoadCallbackInvoked, $var->isCloned, etc) now triggers proxy initialization. I fixed one by changing the variable to a static variable, but I don't know if this is the best approach.

Maybe introduce a magic prefix like $__doctrineInternal_foo? Or add an attribute to mark properties that should not trigger proxy load?

@greg0ire ?

@greg0ire
Copy link
Member

@nicolas-grekas hi! Can you help with this? I think you will have more insight.

@nicolas-grekas
Copy link
Member

I guess we should close as duplicate of #11544 first, then continue on that other issue.

@priyadi
Copy link
Author

priyadi commented Sep 24, 2024

closing in favor of #11544

@priyadi priyadi closed this Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants