DB_DataObjects: How to mix clone and getLinks?
| From: | mitchell perilstein | Date: | Fri, 09 May 2003 20:41:56 +0000 |
| Subject: | DB_DataObjects: How to mix clone and getLinks? | ||
| Groups: | php.pear.general php.pear.general | ||
| Request: | Send a blank email to pear-general+get-5286@lists.php.net to get a copy of this message | ||
Hi all,
I often do stuff like this:
$obj = new DataObjects_MyThing();
$obj->find();
while ($obj->fetch()) {
$obj->getLinks();
$obj->_someChild->foo = 42;
$obj->_someChild->bar = 'quack';
$obj->_someChild->update();
}
For each found object, the loop should do something to a "_" child,
which was loaded with getLinks(), and then does a db update on it.
Each time through the loop, it seems getLinks() provides the OLD copy
obj's child, ie, it is not reloaded and so does not reflect any of the
prior updates().
Is this expected? Is this over-eager caching?
Should getLinks(), or the whole package for that matter, have an option
to disable and enable caching? staticGet() and getLink() would also be
affected if so.
TIA, regards,
--
Mitchell Perilstein
mitch at enetis dot net
www.enetis.net/~mitch