prowebcraft/yii2-double-model

Yii2 - Gii Double Model Generator

Installs: 1 824

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 3

Type:yii2-extension

0.1.4 2020-10-20 13:10 UTC

This package is auto-updated.

Last update: 2024-11-05 18:46:50 UTC


README

This generator generates two ActiveRecord class for the specified database table. An empty one you can extend and a Base one which is the same as the original model generatior.

Installation

The preferred way to install this extension is through composer.

Either run

$ php composer.phar require --dev "prowebcraft/yii2-double-model": "dev-master"

or add

"prowebcraft/yii2-double-model": "dev-master"

to the require section of your composer.json file.

Usage

By Default Extension comes with Bootstrap file. Just install it. If you need manual installation, follow these steps:

//if your gii modules configuration looks like below:
    $config['bootstrap'][] = 'gii';
    $config['modules']['gii'] = 'yii\gii\Module';

//remove this two lines
//Add this into common/config/main-local.php
    'bootstrap' => 'gii',
    'modules' => [
        'gii' => [
            'class' => 'yii\gii\Module',
            'generators' => [
                'doubleModel' => [
                    'class' => 'prowebcraft\yii2doublemodel\generators\model\Generator',
                    'strictReturnTypes' => true,
                ],
                'kartik-crud' => [
                    'class'     => 'prowebcraft\yii2doublemodel\generators\kcrud\Generator',
                ],
            ],
        ],
    ],

Remove strictReturnTypes option if you don't need strict return types

Open URL https://YOUR-YII2-INSTANCE/gii/doubleModel in browser and follow instructions