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
  •  | 
  •  

Domanda

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!

È stato utile?

Soluzione

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).

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top