Re: Scaffolding question 2

2007-04-17 Thread Sonic Baker
Your table structure should be something like:

students (id, name),
awards_ students (student_id, award_id)
awards (id, name, award_type_id),
award_types (id, award_name)

Your model associations should then be:
Student hasAndBelongsToMany Award,
Award hasOne AwardType

Set the reverse assocations if you need them.

HTH,

Sonic

On 4/17/07, surge [EMAIL PROTECTED] wrote:


 Another question about scaffolding:

 Let's say I  have table student and two other tables:
 student_awards, and award_types. Here's an approximate description
 of each table:

 student (id, name),
 student_awards (id, student_id, award_id)
 award_types (id, award_name)

 The idea is that a student has many awards and each award is looked up
 in award_types.

 If I understand correctly, the student model should include a hasMany
 association to student_awards and student_awards should include a
 belongTo association to award_types.

 OK, I'm using scaffolding for all this and when I do an edit on a
 student, no controls relating to the awards are shown. Actually, I'm
 not sure what should be shown in this case.

 I do see a query that selects all records from student_awards that
 have the current student id, but like I said, no other controls are
 shown.

 Thanks for any suggestions!


 


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



Scaffolding question 2

2007-04-16 Thread surge

Another question about scaffolding:

Let's say I  have table student and two other tables:
student_awards, and award_types. Here's an approximate description
of each table:

student (id, name),
student_awards (id, student_id, award_id)
award_types (id, award_name)

The idea is that a student has many awards and each award is looked up
in award_types.

If I understand correctly, the student model should include a hasMany
association to student_awards and student_awards should include a
belongTo association to award_types.

OK, I'm using scaffolding for all this and when I do an edit on a
student, no controls relating to the awards are shown. Actually, I'm
not sure what should be shown in this case.

I do see a query that selects all records from student_awards that
have the current student id, but like I said, no other controls are
shown.

Thanks for any suggestions!


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