sorokinmedia/yii2-generators

Generators for Yii2(gii)

1.2 2018-08-08 05:46 UTC

README

Total Downloads

The extension allows to generate some types of classes on base of existing ActiveRecord model class.

Installation

Install with composer:

composer require --dev ma3obblu/yii2-generators

or add

"ma3obblu/yii2-generators": "*"

to the require section of your composer.json file.

Add new generator into your Gii module config:

$config['modules']['gii'] = [
    'class' => 'yii\gii\Module',
    'generators' => [
        'crud' => [
            'class' => 'ma3obblu\gii\generators\crud\Generator',
        ],
        'entity' => [
            'class' => 'ma3obblu\gii\generators\entity\Generator',
        ],
        'form' => [
            'class' => 'ma3obblu\gii\generators\form\Generator',
        ],
        'handler' => [
            'class' => 'ma3obblu\gii\generators\handler\Generator',
        ],
        'fixture_class' => [
            'class' => 'ma3obblu\gii\generators\fixture_class\Generator',
        ],
        'fixture_data' => [
            'class' => 'ma3obblu\gii\generators\fixture_data\Generator',
        ]
    ],
];

And add the following line:

Yii::setAlias('@tests', dirname(__DIR__) . '/tests');

in top of your config/web.php file.