Gii not generate automatic relations in model class

when i generate model the relations function is empty. what should i do?

Welcome to the forum!

You should use storage engine inno_db and add the foreign key in mysql.

thanks i do the same and its working now.

Hi,

i use engine innodb and i set the foreign keys but gii does not generate the relations array. What could be the problem? I just switched to 1.1.12 and before that the relations generated well.

There’s a checkbox now to select whether Gii should generate the relations. Please make sure it is selected.

It does not work. I checked the whole thing in a previous version(1.1.10), and it worked, the relations array done with generating the models as it was so many times before. So it should be something new in the latest version(1.1.12), maybe a bug.

Yes, if your database schema didn’t change and you are selecting the option to generate the relations, some change introduced with the new version of the framework could be causing the issue.

Please post details of your case in the Bug Discussions forum. You can paste your configuration file and SQL to create the schema in a website like pastie.org.

Good luck!

Note: Please try with giix and let me know if it works.