[Solar-talk] Solar_Sql_Model Feedback

Paul M Jones pmjones at ciaweb.net
Wed Jul 11 17:42:26 CDT 2007


On Jul 11, 2007, at 5:38 PM, Ian Szewczyk wrote:

> Most of the things you mentioned I already understand. I guess I wasnt
> clear in that I was hoping for away to iterate through the collection
> of data, which may or may not include eager loaded relations, and
> bypass the relatively expensive row-object creation that happens in
> the offsetGet method, while at the same time keeping the way you
> access the data more or less the same, and only "stepping into" the
> row-object creation if you need to(wishful thinking maybe).
>
> I imagine in most cases when you setup a collection object to pull out
> data you would go the most practical route and eager load what you
> need. Like on a blog page, you would get the comments eager loaded
> with the users, and you could just want the data and not always the
> fancy stuff that the respective row-objects provide, except maybe in
> special cases. Something like this maybe:
>
> foreach($commentCollection->asArray() AS $commentEntry) {
>     // No row objects made, only working with $_data array
>    echo $commentEntry->message;
>    echo $commentEntry->user->username;
>
>    // Special case
>    if ($something) {
> 	$user = $commentEntry->user->asObject();
> 	$user->someMethod();
>    }
> }

Eager-loading in collections is *exactly* one of the things I want to  
address.  Right now it doesn't exist, and it needs to.  So yeah, I'm  
with you on its importance and practicality, and I want to make it  
work right.  Don't know yet if I can get away with it not creating an  
actual record object (and using only $_data) but if I can, I will.   
It would certainly be less resource-intensive.



--

Paul M. Jones  <http://paul-m-jones.com>

Solar: Simple Object Library and Application Repository
for PHP5.  <http://solarphp.com>

Join the Solar community wiki!  <http://solarphp.org>

Savant: The simple, elegant, and powerful solution for
templates in PHP.  <http://phpsavant.com>




More information about the Solar-talk mailing list