Gii Model Generator Error

Hi, I am trying to run the model generator and I am getting the following error:

Unknown method: yii\db\mysql\Schema::findUniqueIndexes()

Database is InnoDb, UTF8 format.

The table in which I am trying to run the process for contains:

5 fields including an autoid in the first position

1 relationship foreign key field

2 indexes on other fields (so 4 all up, 1 primary, 1 for the FK + 2 other indexes

The database is loaded as autocomplete displays teh table names as I type

Any help would be appreciated.

PS: is there any special order in which the 5 options (model, crud, controller, form, module) should be run? Or is there a tutorial on this for version 2?


Greg Johncock

ensure your yii2 is the latest

that is static function

in mine

public function findUniqueIndexes($table)

Suppose you could get some idea on MVC if you are not familiar. With regards to Gii code generation:

  • A module is only required if you are creating a module - this is the first step if you are creating a module… if not you ignore this.

  • typically in most cases you first start with a model and then generate CRUD which does the rest.

  • if you do not want a CRUD… or for specific customized reasons… you could create a controller and form separately

yes I do need to get my head around the MVC concept so I will do some reading on that.

typically at this stage I just want to create the ability to add/update/delete records in many of the tables in our new database so we can get the gist of how the autocoded forms look and work.

thank you for your reply.

Greg J

thanks for the reply, where would I find that information?

I have installed the code from the latest build and I am still seeing the same error.


Greg J

Check the file vendor/yiisoft/yii2/yii/db/mysql/Schema.php

The file should be newer than 25.12.2013. do a composer update and ensure you are not requiering the alpha release but the latest dev version.