[Solar-talk] How can i implement ordering on a _belongsTo or _hasMany relationship

Cruz, Darwin Darwin.Cruz at gd-ais.com
Fri Feb 15 09:41:26 CST 2008


I'm using the Solar models and need to implement a order by against a
database table column that i'm querying through a 
 _belongsTo or _hasMany relationship.

So if i have a DEPARTMENT model that has many EMPLOYEES my DEPARTMENT
model has the following relationship defined.

        $this->_hasMany('employees', array(
            'foreign_class' => 'Project_Models_Employee',
            'foreign_key'   => 'department_id',
        ));

So if i want to find out all the employess in a specific department i
cause do the following $myDepartment->employees to get all the employee
records.  Is there any way i can implement an ORDER BY clause against
those employee records?

Thanks.

Darwin Cruz 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman-mail3.webfaction.com/pipermail/solar-talk/attachments/20080215/416a8dae/attachment.html


More information about the Solar-talk mailing list