DDC-1022: Wakeup behavior difference between proxy and eager-loaded instance #1612

Closed
doctrinebot opened this Issue Feb 9, 2011 · 5 comments

2 participants

@doctrinebot

Jira issue originally created by user k-fish:

When an object is reconstituted from the persistent storage the unserialize trick is used. That means **wakeup() is called, which is useful to do further initialization as needed.

If the object is lazy loaded a proxy is generated. That proxy is generated with new and thus no *_wakeup() is called. When the proxy is eventually initialized still no call to _*wakeup() is done, thus initialization code that is "usually" executed is not called when an object is lazy-loaded.

That is a semantical error.

@doctrinebot

Comment created by @beberlei:

**wakeup() shouldn't be used as per definition of an entity, http://www.doctrine-project.org/docs/orm/2.0/en/cookbook/implementing-wakeup-or-clone.html

For post initialization "postLoad()" should be used.

@doctrinebot

Comment created by k-fish:

@doctrinebot

Comment created by @beberlei:

I changed my mind, this is valid

@doctrinebot

Comment created by @beberlei:

Fixed in 2.0.7, 2.1.1 and in master

@doctrinebot

Issue was closed with resolution "Fixed"

@beberlei beberlei was assigned by doctrinebot Dec 6, 2015
@doctrinebot doctrinebot added this to the 2.0.7 milestone Dec 6, 2015
@doctrinebot doctrinebot closed this Dec 6, 2015
@doctrinebot doctrinebot added the Bug label Dec 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment