-
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
Lazy-load on a per-property base (removes doctrine proxies, replaced by ProxyManager) #1241
Lazy-load on a per-property base (removes doctrine proxies, replaced by ProxyManager) #1241
Conversation
Hello, thank you for creating this pull request. I have automatically opened an issue http://www.doctrine-project.org/jira/browse/DDC-3481 We use Jira to track the state of pull requests and the versions they got |
hi! If you are considering to release a 3.0 version:
|
I'm not yet considering 3.0. This is just a PR that I opened that is obviously incompatible with 2.x for now. 3.0 will happen, but only after 2.5 and further discussion about what has to land in it. |
IMO, this is fine. If your entity already implements Serializable, it is already initialized when serializing (because of a method call). And if it does not and the proxy is not initialized yet, unserializing it gives you a broken object (because you don't have the initializer closure to initialize the proxy) |
However, the Proxy interface BC break is an issue. Couldn't we still implement this interface ? |
@stof my idea is to modify the code generators to align to the existing interface: not yet sure how. As for I'm fine with breaking BC here though: we had people serializing proxies since ages, and we always told them not to do it; time to stop that. |
Not implementing |
@beberlei I plan to implement |
… makes the uninitialized proxies safe to reuse
…al instance of a proxy
9e11921
to
e437ec4
Compare
Just hooking in @alcaeus' suggestion for partial hydration of proxies: https://gist.github.com/alcaeus/fcc12672d7e46faa23e6c35516802e7b#file-proxy-php-L22 |
This patch needs to be re-applied on top of |
Hey, is there any update on this? Would be a great improvement in some contexts. regards, |
@nsaleh I didn't work further on this, but I will do that as soon as I can. If you want to give it a shot yourself, be my guest! |
Thanks for your quick answer and your work!, i might give it a try, but yeah time is a problem here too. If it would help and be appropriate to do maybe I could get some sponsoring, let me know. As I understand this feature will be shipped with 3.0 is "done when it's done" right? |
Shoot me an email and we'll see if it is feasible. I'm currently flooded
with other work (good for the pockets, not for the time), which is why OSS
currently falls behind
…On 8 Aug 2017 10:55, "Nabil Saleh" ***@***.***> wrote:
Thanks for your quick answer and your work!, i might give it a try, but
yeah time is a problem here too. If it would help and be appropriate to do
maybe I could get some sponsoring, let me know.
As I understand this feature will be shipped with 3.0 is "done when it's
done" right?
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#1241 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAJakIx2sTY28IXS5u2E2PvkjufqWRSCks5sWCJpgaJpZM4DQhEA>
.
|
This was moved to #6719 |
This is just a proof of concept that I hacked together real quick.
This changes how proxies are generated and lazy-loaded in a very radical way:
$class = get_class($proxy); $object = new $class();
without any side-effects, as the constructor logic is preservedFollowing BC breaks need to be fixed or discussed before going forward on this idea:
Doctrine\Common\Proxy\Proxy
anymore, butProxyManager\Proxy\GhostObjectInterface
(BC break, needs fixing, can be easily done with some effort)BC break is voluntaryserialize($proxy)
now causes proxy initialization(probably needs fixing, as this is a major BC break)- BC break is voluntaryPending TODOs:
__clone
)class
in stack traces facebook/hhvm#4560)To give you an example, it is impossible (without reflection) to cause lazy-loading for the following class: