Question about many-to-many relations

Hi all,

in my current project i have many-to-many relations. Let’s say between Blog-Postings and Categories :rolleyes:. Now when creating a new posting i want to choose multiple categories to be assigned to that posting.

So i modified the create- and update-action to also update the table for the many-to-many assignments (like here larryullman.com/2010/08/10/handling-related-models-in-yii-forms/).

My question is if that is still the correct way to do this or does YII v1.1.8 already provide some code to simplify that?

For example i found out that modifying the loadModel-method (like shown in the article above) is not neccessary anymore since $model->categories is already an array of category-ids.

Nothing is built-in as core. There are extensions that do so.

So it is still the correct way to fill the assignment-table manually (in create/update action) if no extensions should be used? :)

Yes - its what I’m using.

I will probably pick one of the extensions and use that going forward unless they incorporate into the core. I wanted to make sure I knew how to do it without an extension first though.

Ok, thx for your reply!