mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-155: [2.0] ProxyFactory generates two __sleep methods() #192
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Nov 17, 2009).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user reinier.kip:
The proxy factory seems to generate two *_sleep methods if the parent class also implements __sleep: one by _generateMethods and one by *generateSleep.
@doctrinebot commented on GitHub (Nov 17, 2009):
Comment created by romanb:
Note that if you use __sleep/__wakeup in your entities you should better implement Serializable instead. We're working on removing the no-arg constructor requirement and this has consequences on __wakeup.
See DDC-79 for details.
@doctrinebot commented on GitHub (Nov 17, 2009):
Comment created by reinier.kip:
Ah yes, DDC-79. Very interesting improvement. Thanks for the hint on the Serializable.
@doctrinebot commented on GitHub (Dec 8, 2009):
Comment created by @beberlei:
What should we do about this issue.
@doctrinebot commented on GitHub (Dec 17, 2009):
Comment created by romanb:
_generateMethods should probably skip the __sleep method?
@doctrinebot commented on GitHub (Jan 5, 2010):
Comment created by reinier.kip:
Is the consequence on __wakeup that __wakeup can't rely on its properties, as the object is still to be hydrated? What about unserializing with the properties in place? What other consequences are there?
The thing is that implementing Serializable is quite different than taking the __sleep/__wakeup approach. When using Serializable, PHP does not take care of circular references ($a->ref->ref === $a). This is expected behaviour and the implementer is expected to take care of this him- or herself. This is why, although I like an interface better than "magic methods", I prefer __sleep and __wakeup.
Please discuss.
@doctrinebot commented on GitHub (Jan 6, 2010):
Comment created by @beberlei:
Hm there are not really effects on **sleep, just on wakeup i guess.
**wakeup will be called by Doctrine soon, its probably just something you have to be aware of.
Nevertheless, I'll skip sleep in generateMethods, its a bug.
@doctrinebot commented on GitHub (Jan 6, 2010):
Comment created by @beberlei:
Fixed in trunk, sleep is skipped.
@doctrinebot commented on GitHub (Jan 6, 2010):
Issue was closed with resolution "Fixed"