Yii - Can gii be used to create CRUD for a Model that joins tables through relations?

StackOverflow https://stackoverflow.com/questions/16694732

  •  30-05-2022
  •  | 
  •  

문제

I'm planning on creating a model that joins some tables to be used in a CGridView. Will the CRUD generated by gii work on this? Specifically the ability to Create/Update.

I've already tried generating CRUD on a MYSQL view - which did not work right for Create/Update.

Thanks!

도움이 되었습니까?

해결책

It is my understanding that MySql's ISAM does not support relations. However, if you create your tables with the INNODB engine, you can define foreign keys.

It is also supported by SQLite, however. The Yii blogs tutorial shows an example of defining relations at the database level.

In that case, Gii dutifully creates Models with the relations predefined (or better: taken from the database).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top