[Solar-talk] Selecting Cols w/ eager

Paul M Jones pmjones at ciaweb.net
Mon Nov 19 11:17:25 CST 2007


On Nov 18, 2007, at 9:30 PM, Raymond Kolbe wrote:

> As you can see, the query tries to search for these columns on the  
> table for Example and not Users. I have tried a few different  
> things but cannot seem to find a way to work around this. I would  
> rather not have Solar return all cols from related tables that I  
> call using eager ( e.g. password, salt, etc).

IIRC you use the relationship name as the table name; e.g., on a  
related "foo", use "foo.colname".  So in the above example you would  
ask for 'cols' => array('user.id', 'user.name'), and not  
"users.colname".

Alternatively, you can set up a "has-one limited_user" and define the  
limited_user relation cols to be only the cols you want.  That can be  
in addition to the regular "user" when you want all the cols.

Let me know if that helps or not.


> ps I am really liking the model relations in Solar. Keep up the  
> good work!

Thanks!  Keep asking these questions, too, they're helping me to work  
out the kinks for real-world usage.




--

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