Built In Way Of Saving Many_Many

Hey there! I need to implement many_many relation, but as I look through the internet I realised that I have no other option to save my many_many model but using some quite old (but still working) extensions like this: http://www.yiiframework.com/extension/cadvancedarbehavior/

And here is my question: is there already some standart built-in way to save this kind of models or I still have to use some external features to do such a basic thing?

Thanks in advance.

Most of these extensions work very well. If you don’t want to use them, you’ll need to create a model for the intersection table and manually populate and save it.

See this post - look for the actionCreate method


Thank you for the great link! And now, when I can use both approaches - which practise is better?

You should know how your code works. The extensions work but before I would use them I would take a look at the code and see if you understand it. There can be a lot of unintended results using someone else’s code… which is why I am really perplexed that this basic and essential function is not in the core already.

For what its worth I use a model for junction table as in Larry’s example.

Thanks a lot, hope this feature will be in the Yii’s 2.0 core.