Urgent Table Prefix Question


I allways setup table prefix - for this post lets say my prefix is abc_

So in common\config\main-local.php I have :

'components' => [

    'db' => [

        'class' => 'yii\db\Connection',

        'dsn' => 'mysql:host=localhost;dbname=database',

        'username' => 'user',

        'password' => 'pwd',

        'charset' => 'utf8',

        'tablePrefix' => 'abc_',



I have worked on Yii1 and used gii to generate models

In this version it generated files like : table.php

Now I work with Yii2 and learn the differences :

gii generate files like abc_table.php

yes I checked "Use Table Prefix"

This is not ok because prefix should be transparent

Could please anyone tell me what I’m doing wrong ?

Hey have tried a few different combos, so long as I have ‘tablePrefix’ set and it matches the table/s in questions prefix my model php files DO NOT include the prefix.

In fact here is happens for me:

'tablePrefix' => 'abc_'

and say i have a table called


then my php model file is called


so something else could be at play with how you gii is working. do you have any other ‘tweaks’ or configurations set that could override the default gii behaviour?

Maybe something like this might help.



Sorry - I should have seen this - I always referred to suggested values

But I have to enter classname without prefix