Sorry, in the previous post "Item belongsTo Theme" !

On 12 juin, 15:25, avairet <[EMAIL PROTECTED]> wrote:
> Another same kind of problem:
>
> "Item hasOne Theme"
>
> Foreign key = theme_id
>
> In Theme controller, I've setted "$displayFields = 'name';"
>
> In my index view, the default paginate HTML table is good: Items are
> sorted by id and in the "Theme" column, names are displayed instead of
> ids.
>
> But when I click on "Theme" column to sort by theme, sort not reflect
> lexical order of themes but id order.
> I know it's normal because of the foreign key "theme_id" is the
> sorting key, but how can I make a lexical sort?
>
> On 12 juin, 13:15, avairet <[EMAIL PROTECTED]> wrote:
>
> > TABLES :
>
> > A) types: id, name, slug
>
> > B) famille_types: id, name, type_famille
>
> > C) famille_types_types (this is the join table) : type_id,
> > famille_type_id
>
> > MODEL ASSOCIATION :
>
> > "Type" HABTM "FamilleType"
>
> > In a index view, I would like paginate Type order by
> > "famille_types.name" not "famille_types.id" which is the default
> > behavior.
>
> > Here is the SQL request I would like to reproduce:
>
> > "SELECT types.id, types.slug, types.name, famille_types.name FROM
> > types INNER JOIN famille_types_types ON famille_types_types.type_id =
> > types.id INNER JOIN famille_types ON
> > famille_types_types.famille_type_id = famille_types.id ORDER BY
> > famille_types.name"
>
> > So how can I do that?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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