Hi Lynda,

I think the association you need is a hasMany since book can have many
questions.  I assume a question is specific to a book, so the question
model would have a belongsTo association with book.

However you have two there pointing to the same table so it's a bit
tricky.  What is the purpose of the questions and req_questions?
Maybe there's another way to achieve the same result?  Can you simply
put a value (1 or 0) in the questions table to denote whether it's a
normal quesiton or req_question?


Also as an aside, the primary key for "books" and "questions" should
be "id" in both cases not "book_id" and "question_id"
It took me a while to understand this as well. :-) Cake expects the
primary key of every table to be "id" and you can then refer to it
from other tables as "modelname_id"

e.g.
You could have a table "notes" to add notes about each book.
This table would have a field "book_id" which cake automatically links
to the "id" field in "books" if you setup a belongsTo association in
the "notes" model and a hasMany association in the "books" model.


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

Reply via email to