[Solar-talk] Changes afoot: a new Model class
Rodrigo Moraes
rodrigo.moraes at gmail.com
Mon Feb 12 04:27:24 PST 2007
On 2/10/07, Paul M Jones wrote:
> When you get a record with a to-many relationship, before you ask for
> (say) the "comments" on that record, you can tell it what page of
> comments to fetch.
>
> $node = $nodes->fetch($id);
>
> $node->setRelatedPage('comments', 1); // set page 1,
> $node->dump($node->comments); // query and display 1st page
>
> $node->setRelatedPage('comments', 2); // set page 2, clear
> RecordSet
> $node->dump($node->comments); // query and display 2nd page
Very clean! Can't wait to see the model saving records. :)
Hey, I was playing with it and I think I found a candidate for a new
method: getRecordSetObject($data), extracted from fetchAll(). Only
needed when you override fetchAll(), but I think there are some cases
to do this (even more now that it receives an array as parameter, so
it became easier to override).
rodrigo
-------------------------------
http://tipos.com.br
More information about the solar-talk
mailing list