Unable to create CRUD via gii

209 views Asked by At

I have generated a Model using gii of an InnoDB view, which worked.

Then trying to use the gii CRUD generator for the model, I am getting this error

The table associated with app\models\Future must have a primary key(s).

I have also looked into this question. But the table doesn't have any primary key and also I can't create any primary key because the DB is 3rd party DB.

Is there any way to create CRUD without having a primary key?

Any help would be highly appreciated.

1

There are 1 answers

0
Milan Suthar On

Try to define PK using:

public static function primaryKey()
{
    return ['name'];
}