Gii And Many-To-Many Relationship (Pivot Table)?

Hi everyone,

I was playing around with Gii to generate a few models from my database, however I’ve noticed that the many-to-many relationships using pivot table are not generated by Gii.

I was wondering if they’re not supported (as code generation) and if I should create them manually.

Many thanks,


How are they defined in your SQL? Yii can only detect them if foreign keys are defined correctly.

Sorry, my bad. While checking if FK where ok, I’ve noticed that I didn’t synchronize the database with the model so the pivot table were missing from the db.

Please delete this post (I think I cannot delete it), sorry again.