Add New Row To Many To Many Table

Consider i have 3 tables:

question [id(pk), text]

question_category [id(pk), name]

question_question_category [question_id(fk), question_category_id(fk)]

of course I have 2 models, Question and QuestionCategory

If I’m trying to do something like this, I got error and it won’t add anything to my question_question_category table:




$question = new Question();

$question_category = QuestionCategory::model()->findByPk(1);

$question->tblQuestionCategories[] = $question_category;

I want to know how can I add something in my question_question_category table ? (without generatin a QuestionQuestionCategory model and doing it manually)

simply using this extenstion solved my problem. I hope this implements as a core feature in next version of Yii :)

Your link didn’t get pasted. Which extension you’re talking about?