CakePHP model conventions - relation to relation -


i have these tables: questions, question_sets.

so it's along convention do: questions_question_sets.

right? next, have table: answers.

every questions_question_sets has many answers need build column name singular. going be: 1. questions_question_set_id or 2. question_question_set_id?

i guess should 1st knows...

tldr:

questions_question_set_id 

further details in case next person trying this:

based on you're trying do, i'm going assume question can belong more 1 questionset, , answer specific question within specific questionset (as opposed seems logical me - answer belongs question regardless of questionset it's in).

models

question questionset answer questionsquestionsset 

tables

questions id question_sets id answers id questions_question_set_id questions_question_sets id question_id question_set_id 

associations

question hasandbelongstomany questionset questionset hasandbelongstomany questions answer belongsto questionsquestionset questionsquestionset hasmany answer 

fields


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -