I have this DB Structure:
Groups
id
name
description
CompanyGroups
id
groupId
companyId
isChief
Company
id
name
etc...
My Group Bean has this relation for a N:N relationship with Companies.
'companyGroup'=>array(self::HAS_MANY, 'CompanyGroup', 'groupId','order'=>'isParent DESC'),
As you can see, I put an order clausole to have CHIEF COMPANY as first.
Now. The CompanyGroup class has his own relations with Company as below:
return array(
'group'=>array(self::BELONGS_TO, 'Group', 'groupId'),
'company'=>array(self::BELONGS_TO, 'Company', 'companyId','order'=>'name asc'),
);
Unfortunally, the other companies are not sorted and I need a "name ASC" ordering clausole.
QUESTION:
How can I order a relations for a main attribute and then for an attribute of a inner relations?
As you can see, I’ve tried to put a specific ordering clausole in CompanyGroup relation with Company but is not working.
Thank you for any advice!