It seems that whenever the same instance of ResultSet is repeatedly iterated, it recreates the Model instances every time.
For the sake of example, here I'm looping over a ResultSet to change the "name" property of every Model instance. However the next loop prints the original value instead of the changed one.
// get the ResultSet
$childList = $this->getChildNodes();
foreach ($childList as $child)
{
$child->name = 'boo';
}
foreach ($childList as $child)
{
var_dump($child->name);
}
if I replace the first line with this, then it works:
$childList = array();
foreach ($this->getChildNodes() as $child)
{
$childList[] = $child;
}
Perhaps there's something I'm doing wrong?