you can set the main order by $this->Member->order = "last_name ASC",
before calling the find.
hth

On Feb 17, 6:45 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> I understand how to set the ordering for the bound models, but how can
> I set restrictions and also give an order for the main model?
>
> for instance, I want to select all members whose last names begin with
> a particular letter, binding ther profiles, restricted to email &
> phone. But I'd like the members ordered by last_name. Bindable's
> restrict syntax has a way to order, but only for the bound models, not
> the main one. And it seems to be somehow interfering with the $order
> param given to find() (although, looking at the bindable.php source, I
> can't figure out why).
>
> $conditions = array(
>         'conditions' => "LOWER(SUBSTRING(last_name, 1, 1)) = '${letter}'",
>         'restrict' => array('MemberProfile(email, telephone)')
> );
>
> $order = 'Member.last_name ASC';
> $this->set('members', $this->Member->find('all', $conditions, null,
> $order));
>
> This selects everything fine except there's no ORDER BY clause.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to