Methods like getCollection, getIterator etc. returns array of xPDO Criteria objects. I thought what work with one of these objects is identical to objects, getted by getObject.. Unfortunally, ->save() method works only in object, getted by getObject - it is a bug or "feature"?
I expected what my code should be like this (1 select + N update queries):
$linkpage = $this->xpdo->getIterator('Linkpages', $this->dbQuery);
foreach ($linkpages as $linkpage) {
$linkpage->set('content', $this->content);
$linkpage->save();
}
But currently works only this solution (1+N select + N update queries):
$linkpage = $this->xpdo->getIterator('Linkpages', $this->dbQuery);
foreach ($linkpages as $linkpage) {
$updatable_linkpage = $this->xpdo->getObject('Linkpages', $linkpage->id_linkpage);
$updatable_linkpage->set('content', $this->content);
$updatable_linkpage->save();
}
So it's very unoptimized. Especially when such situations is usual.
Is there any other easy solution to "do more with less"?