Can anyone provide guidance or an example of how to best design and use an associative array with Yii?
The example I am toying with is a post that can be assigned to multiple categories. I want to use a post_cat table to associate the post and categories and have defined foreign keys as shown in attachment.
post_cat key is a unique id since Yii won’t crud a composite key?
I created models and crud. Where I am stumped is the view/edit/save piece relating to the associative table.
> Displaying the list of categories when editing the post and selecting those that are associated with the post.
> Then when saving, how to write to both the post and post_cat tables?
Using this information, I created the relationship and can display the attached categories when viewing a post. How do I save changes to these when the post is updated? I assume I will need to call the post_catController since these are in a separate table?