Re: findAll and order by related detail

2007-06-19 Thread Chris

Did you ever get a response to this question, I'm looking for the same
thing?

On May 21, 7:37 am, szeta <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I don't know how I can achieve this..
>
> I want to find all Persons, butorderthem by the 'Due_Date' of the
> 'Group' they are assigned to (hasAndBelongsToMany).
>
> $this->Person->bindModel(array('hasAndBelongsToMany' => array('Group'
> => array(
> 'className' => 'Group',
> 'joinTable' => 'group_person',
> 'foreignKey' => 'person_ID',
> 'associationForeignKey' => 'group_ID',
> 'conditions' => '',
> 'fields' => array('ID', 'Due_Date'),
> ;
>
> $this->Person->findAll('','','Group.Due_Date'); does not work.
>
> Setting 'order' => 'group.Due_Date' in the HABTM definition does not
> work either.
>
> Has anybody done this and can give me a hint?
>
> Kind regards
> Ralph


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



findAll and order by related detail

2007-05-21 Thread szeta

Hello,

I don't know how I can achieve this..

I want to find all Persons, but order them by the 'Due_Date' of the
'Group' they are assigned to (hasAndBelongsToMany).

$this->Person->bindModel(array('hasAndBelongsToMany' => array('Group'
=> array(
'className' => 'Group',
'joinTable' => 'group_person',
'foreignKey' => 'person_ID',
'associationForeignKey' => 'group_ID',
'conditions' => '',
'fields' => array('ID', 'Due_Date'),
;

$this->Person->findAll('','','Group.Due_Date'); does not work.

Setting 'order' => 'group.Due_Date' in the HABTM definition does not
work either.

Has anybody done this and can give me a hint?

Kind regards
Ralph


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---