unconfirmed answer: i think i read somewhere in the manual or the wiki
that this was the case i.e. the foreign keys had to be in order.

can lead to trouble if you don't know about it ;)

On 23/08/06, clemos <[EMAIL PROTECTED]> wrote:
>
> hi
>
> as described in the subject, I've went through a small problem with 
> scaffolding:
> it looks like the order of the foreign key fields in the database
> table and the order of the assocation definition in a model's
> $belongsTo *must* be the same to make scaffolding work
>
> exemple:
> I have a table "projects" with id, title, group_id, category_id
> (defined in this order in the table)
> say my Project model's $belongsTo table looks like this :
>
> $belongsTo = array(
>   "Group"=>array(
>     "className"=>"Group",
>     "foreignKey"=>"group_id"
>   ),
>   "Category"=>array(
>     "className"=>"Category",
>     "foreignKey"=>"category_id"
>   )
> );
>
> then the scaffolding will work well
> if it looks like this (reverse order) :
>
> $belongsTo = array(
>   "Category"=>array(
>     "className"=>"Category",
>     "foreignKey"=>"category_id"
>   ),
>   "Group"=>array(
>     "className"=>"Group",
>     "foreignKey"=>"group_id"
>   )
> );
>
> then scaffolding won't work:
> it will complain because it can't find the displayField in the
> "Category" and "Group" result arrays. this is because it has switched
> the two arrays (trying to find Category's displayField in the Group
> result array, and so on)
>
> anyway, it's ok because I've managed to find the problem,
> yet, even if more or less "logical", I don't find this very convenient.
>
> what do you think ?
> in other words : is it a bug or a feature :) ?
>
> ++++++
> clemos
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to