yossi
yossi

Reputation: 3164

cakePHP, model relations - hasOne, how to update both tables?

I have two tables: answers{..., question_id} and questions{..., answer_id}.
In the models I set the $hasOne variable to connect the models: Answers: $hasOne = 'Question' and Question: $hasOne = 'Answers'
There are two views: answers->add and questions->add, for each question there is only one answer.
Now, I want these tables to be connected, so when a user create a question it will automatically create an answer (tho empty). I know it's a lot.. But, How it is done?

Upvotes: 0

Views: 515

Answers (1)

Related Questions