AR insert question

I've two tables - category and news. Relation is many to many. Relation table is newscategory(newsid, categoryid) . It is possible to insert values into newscategory using AR when i add new news? I don't have ar model for newscategory table, only for news and for category

Nope, Yii AR doesn't support automatically insertion or deletion of related objects.

Hello everyone.

Sorry to open again this thread! Just to confirm! Can I insert related objects with a unique save like Hibernate?

Example:





public function actionInsert(){


     //transaction, try catch and post control


     $c = new Company();

     $a = new Address(); //Adress is related to company




     $c->attributes = $_POST["Company"];

     $a->attributes = $_POST["Address"];


     $c->address = $a;

     $c->save();


}




Could I?

So, the answer is NOT. (Or at least not yet!!)