For the scaffolding to show the description instead of the id you need
to add this to your Status/Priority model:
 var $displayField = 'description';

and to accomplish what you are wanting with Status/Priority I had to
make it a $belongsTo instead of a $hasOne ($hasOne expects the Status
& Priority tables to have a item_id foreign key.)  Seems odd, but
that's the only way I know to make it work, but I have about the same
amount of experience as you ;)

Hope that helps!

-- Brian

On May 23, 7:00 am, "Howard Glynn" <[EMAIL PROTECTED]> wrote:
> been using cake a fortnight or so, very impressed, i'm up and running and
> it is saving heaps of time  :-) ... but looking for a little clarificaton
>
> Say I have a model called "Items" which is my main table of data.
> This contains a couple of foreign keys, say "status_id" and "priority_id"
>
> "Statuses" and "Priorities" contain two fields, id and description
> (these occasionally get changed and updated, especially by admin users,
> which is why they need their own models to update via web form)
>
> I think it is an M:1 relationship from Items to Statuses [or Priorities]
> (i.e. Many different Items can have the same status [or priority])
>
> In Items, and this class alone, I say something like below. Is
> this the right relationship descriptor? Does "Statuses" need anything?
> I've tried reading the docs but i can't quite get my head round it.
>
>     var $hasOne = array(
>         'Status' =>
>             array('className' => 'Status',
>                 'foreignKey' => 'id',
>                 'conditions' => '',
>                 'fields' => '',
>                 'order' => '',
>                 'dependent' => 'false'
>             ),
>
> If I do this, what can I expect? I was kind of hoping the scaffolding would
> replace
> the numeric id's in the basic form with the descriptive versions (maybe that
> is asking
> a little too much!)  Is it the case that the data is in the variable on the
> page, i just need
>
> Ta, HG


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