Generates 2 models classes instead of just one. This is useful if you are frequently re-generating your models from a schema and want to separate model definitions from custom functionality.
For example: table post
\common\models\base\Post
- contains table meta (relations, property definitions, tableName
, rules
, attributeLabels
)\common\models\Post
- is left almost empty for custom functionalityThe easiest way to obtain the code is using Composer: just modify your composer.json
to add a custom repository (linking to this project) and require the libary.
{
"require": {
"opus-online/yii2-giimodel": "1.1.*"
}
}
To add the Gii generator to your project, just add the class \opus\giimodel\Generator
as a new generator to your gii module configuration:
'modules' => [
'gii' => [
'class' => 'yii\gii\Module',
'allowedIPs' => ['*'],
'generators' => [
'giimodel' => [
'class' => '\opus\giimodel\Generator',
'prefixMap' => [
'tbl_user_' => 'user',
'tbl_' => '',
'ext_' => 'sub/dir',
]
]
]
]
]
1.1.0
1.0.0
Comments