I have an association table tbl_user_bu_assignment which stores the many to many relationship of users to their business units.
I am following this article: http://www.larryullman.com/2010/08/10/handling-related-models-in-yii-forms/
In here, Larry has got the association table as an actual model, and in the controller code stores the MODEL as such:
if($model->save()) {
foreach ($_POST['Posts']['categories'] as $categoryId) {
$postCategory = new PostsCategories;
$postCategory->postId = $model->id;
$postCategory->categoryId = $categoryId;
if (!$postCategory->save()) print_r($postCategory->errors);
Since I don’t have a model defined for my association table (as per the user_project_assignment table in the Agile Development yii book which also doesn’t define a model for association tables),
how can I save a record in my assoc table to store the relationship data?
any help much appreciated
gvanto