[Solar-talk] Selecting Cols w/ eager
Raymond Kolbe
rkolbe at gmail.com
Sun Nov 18 21:30:26 CST 2007
Hey folks,
I couldn't find a way to do this so I thought I would ask ;-)
Let's say I have a controller, Vendor_App_ExampleController. This controller
uses the model called Vendor_Model_Example and this model has a relationship
to Vendor_Model_Users.
In the controller I only call Vendor_Model_Example and pass it (or rather,
pass it to fetchAll()) 'eager' => 'user' (the relationship name I setup in
the Example model) and return it in a variable named, let's say
$_example_model. Now I can access $this->_example_model->name and
$this->_example_model->user->name (given that I have cols named 'name' in
the database table).
The problem I am having is this...how can I specify the cols for eager?
Here's some quick & dirty code:
(in Vendor_App_ExampleController)
$params = array(
'eager' => 'user',
'cols' => array('users.id', 'users.name'),
);
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).
Thanks in advanced,
Raymond K.
ps I am really liking the model relations in Solar. Keep up the good work!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman-mail3.webfaction.com/pipermail/solar-talk/attachments/20071118/2868adbf/attachment.html
More information about the Solar-talk
mailing list