So far using AR has been fairly smooth sailing for me especially with the help of CRUD tools. However, I’ve hit a dead end.
I have a many to many relationship with a linker table:
tbl_exercise, tbl_exercise_link_template and tbl_template
The idea is that each template consists of may exercises. My template table only has two fields, id and name. The template is meant to then have a list of exercises as part of it, which is expressed in the linker table.
How do I create a form where I can create a new template with selected exercises (identified by their id)?
In the case of one form representing a table directly it is easy. You create a model instance for that table, read the form, validate -> save(). In the M:M case I need to use more than one model, right?
I’ve had a look around and I must be using the wrong search terms.
I’d appreciate any help.
finally found this:
I take it I have to use an extension?
I seem to have found three extensions covering the same functionality. This one has the most upvotes: http://www.yiiframework.com/extension/cadvancedarbehavior/
Any comments on what the current situation is would be more than welcome.
third edit: I’m just really confused. The example on the yii homepage only seems to do relational queries for retrieving data and doesn’t mention saving.