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

Closed
opened 2026-01-22 13:07:59 +01:00 by admin · 5 comments
Owner

Originally created by @doctrinebot on GitHub (Feb 9, 2011).

Originally assigned to: @beberlei on GitHub.

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.

Originally created by @doctrinebot on GitHub (Feb 9, 2011). Originally assigned to: @beberlei on GitHub. 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.
admin added the Bug label 2026-01-22 13:07:59 +01:00
admin closed this issue 2026-01-22 13:08:01 +01:00
Author
Owner

@doctrinebot commented on GitHub (Feb 26, 2011):

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 commented on GitHub (Feb 26, 2011): 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.
Author
Owner

@doctrinebot commented on GitHub (Feb 26, 2011):

Comment created by k-fish:

@doctrinebot commented on GitHub (Feb 26, 2011): Comment created by k-fish:
Author
Owner

@doctrinebot commented on GitHub (Jul 9, 2011):

Comment created by @beberlei:

I changed my mind, this is valid

@doctrinebot commented on GitHub (Jul 9, 2011): Comment created by @beberlei: I changed my mind, this is valid
Author
Owner

@doctrinebot commented on GitHub (Jul 9, 2011):

Comment created by @beberlei:

Fixed in 2.0.7, 2.1.1 and in master

@doctrinebot commented on GitHub (Jul 9, 2011): Comment created by @beberlei: Fixed in 2.0.7, 2.1.1 and in master
Author
Owner

@doctrinebot commented on GitHub (Jul 9, 2011):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Jul 9, 2011): Issue was closed with resolution "Fixed"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#1275