[Solar-talk] Changes afoot: a new Model class

Rodrigo Moraes rodrigo.moraes at gmail.com
Wed Feb 7 17:52:15 PST 2007


On 2/7/07, Paul M Jones wrote:
> I have this in place right now:
>
>      $this->_hasMany('comments', array('limit' => 25, 'order' =>
> 'comments.id DESC'));
>
> So you always get the last 25 comments, no offset.  Would that help?

Yes, it would help in some cases, when you know or control the amount;
there are other cases where you'd need to select more (or at least
paged) data. But nothing that a subclass can't solve (more below)...

> I've been thinking about that, and I really like the idea, but it's
> not possible with Solar_Sql_Model just yet.  The question is, how
> would you implement it?  What would the method-calls look like in
> practice?
>
> Maybe I can add something to RecordSet that reloads based on the page
> number, for $post->comments->loadPage(2) to make a new SELECT and
> reload new comments data.
>
> Actually, that's not a bad idea.  Let me think on it some more.  And,
> of course, happy to take suggestions.

Well, a method could be defined in a Record subclass:

    $post->getRelatedPage('comments', 2);

And then execute the SELECT directly, avoiding the load/reload. Bad
idea? I'd prefer the method call than loading/reloading. :)

Thinking on this, there are too many possibilities we can play with in
subclasses.

rodrigo
-------------------------------
http://tipos.com.br


More information about the solar-talk mailing list