So, in this case we have 2 tables on my database.
1. questions
2. answers
questions hasAndBelongsToMany answers
Answer hasAndBelongsToMany questions
questions hasOne answers
answers belongsTo questions
There is no troble or conflict when questions hasAndBelongsToMany
answers but also questions hasOne answers?
Anyway i will try to baking this tables;
Thanks
On Tue, Nov 3, 2009 at 8:02 PM, John Andersen <j.andersen.lv@gmail.com> wrote:
>
> 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
> >
>
--
Mufti Ali
087831163105
http://wordtaps.com
http://blogfreakz.com
--~--~---------~--~----~------------~-------~--~----~
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:
Post a Comment