diff options
author | Brion Vibber <brion@pobox.com> | 2010-03-17 12:15:40 -0700 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2010-03-17 12:15:40 -0700 |
commit | 67f2f01c5e1cad743e849cdaaaf11deb6e435844 (patch) | |
tree | cad1ddbfef5a9b28bc8c13cf7f4ba6240bf6f7d0 /classes/Safe_DataObject.php | |
parent | 1c942afa60b7ec5a8f0855a14d32110837270119 (diff) | |
parent | ca5612c451e4dabde107ff2cfbc737a2f69136df (diff) |
Merge branch 'testing' into 0.9.x
Diffstat (limited to 'classes/Safe_DataObject.php')
-rw-r--r-- | classes/Safe_DataObject.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/classes/Safe_DataObject.php b/classes/Safe_DataObject.php index 021f7b506..08bc6846f 100644 --- a/classes/Safe_DataObject.php +++ b/classes/Safe_DataObject.php @@ -43,6 +43,25 @@ class Safe_DataObject extends DB_DataObject } /** + * Magic function called at clone() time. + * + * We use this to drop connection with some global resources. + * This supports the fairly common pattern where individual + * items being read in a loop via a single object are cloned + * for individual processing, then fall out of scope when the + * loop comes around again. + * + * As that triggers the destructor, we want to make sure that + * the original object doesn't have its database result killed. + * It will still be freed properly when the original object + * gets destroyed. + */ + function __clone() + { + $this->_DB_resultid = false; + } + + /** * Magic function called at serialize() time. * * We use this to drop a couple process-specific references |