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
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();
}