Tuesday, November 3, 2009

Re: Trivia quiz model relationship

Question hasMany optional Answer
Question hasOne correct Answer

What you then need is only the models to define the trivias:
Question hasAndBelongsToMany Answer
Answer hasAndBelongsToMany Question
Question hasOne Answer
Answer belongsTo Question

Do observe that there are two associations between Answer and
Question. CakePHP can handle that, you just have to define it!

When a user is going to give the solution to each question, you would
need:
User hasMany Solution
Solution belongsTo User
Solution belongsTo Question
Solution belongsTo Answer

Enjoy,
John


On Nov 3, 7:58 am, mupet <muftimas...@gmail.com> wrote:
> Hi, i will create trivia quiz application using cakePHP,  i have
> trouble on designing model reationship.
> In this case i have question, answers and correct answer.
> which is  One question have 3 optional answers but have only 1 correct
> answers. How to design model relationship?
>
> Thanks and regards
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: