2017 © Pedro Peláez
 

yii2-extension yii2-giix

Yii2 gii generator based on schmunk42 yii2-giiant

image

carono/yii2-giix

Yii2 gii generator based on schmunk42 yii2-giiant

  • Monday, July 9, 2018
  • by carono
  • Repository
  • 1 Watchers
  • 1 Stars
  • 554 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 25 Versions
  • 8 % Grown

The README.md

Установка

composer require carono/yii2-giix, (*1)

Введение

Компонент для массовой генерации базовых моделей на основе schmunk42/yii2-giiant, (*2)

Использование

После подключения пакета, через bootstrap добавляется команда в консольное приложение
yii giix, (*3)

Генерируемые файлы

[app]
    [models] Неперезаписываемые модели
        [base] Перезаписываемые базовые модели
        [query] Неперезаписываемые модели запросов    
            [base] Перезаписываемые базовые модели запросов

Изменение шаблонов генератора

В конфиге настраиваем генератор, (*4)

 'controllerMap' => [
        'giix' => [
            'class' => 'carono\giix\GiixController',
            'templatePath' => '@app/templates/model',
            'generator' => [
                'class' => 'carono\giix\generators\model\Generator'
            ]
        ],
    ],

Создаём новый класс, который будет создаваться на каждую таблицу, (*5)

<?php

namespace app\templates\model;

use carono\codegen\ClassGenerator;
use Nette\PhpGenerator\Method;

class Finder extends ClassGenerator
{
    protected function formExtends()
    {
        return 'yii\base\Model';
    }

    protected function formClassNamespace()
    {
        return 'app\models\finders';
    }

    protected function formClassName()
    {
        return $this->params['className'] . 'Finder';
    }

    protected function formOutputPath()
    {
        return \Yii::getAlias('@app/models/finders/' . $this->formClassName() . '.php');
    }

    /**
     * @param Method $method
     */
    public function myFunction($method)
    {
        $method->addParameter('param');
        $method->addBody('echo "Hello World";');
    }
}

На выходе получаем в папке models/finders файлы:, (*6)

<?php

/**
 * This class is generated using the package carono/codegen
 */

namespace app\models\finders;

class UserFinder extends \yii\base\Model
{
    public function myFunction($param)
    {
        echo "Hello World";
    }
}

Шаблоны

Класс Описание
carono\giix\templates\model\Model Базовый класс модели, перезаписывается
carono\giix\templates\model\ModelExtended Основной класс модели
carono\giix\templates\model\Query Базовый класс модели запроса, перезаписывается
carono\giix\templates\model\QueryExtended Основной класс запроса

The Versions

09/07 2018

dev-feature/depends

dev-feature/depends

Yii2 gii generator based on schmunk42 yii2-giiant

  Sources   Download

MIT

The Requires

 

by carno

27/04 2018

dev-master

9999999-dev

Yii2 gii generator based on schmunk42 yii2-giiant

  Sources   Download

MIT

The Requires

 

by carno

27/04 2018

0.4.4

0.4.4.0

Yii2 gii generator based on schmunk42 yii2-giiant

  Sources   Download

MIT

The Requires

 

by carno

14/04 2018

0.4.3

0.4.3.0

Yii2 gii generator based on schmunk42 yii2-giiant

  Sources   Download

MIT

The Requires

 

by carno

04/04 2018

0.4.2

0.4.2.0

Yii2 gii generator based on schmunk42 yii2-giiant

  Sources   Download

MIT

The Requires

 

by carno

05/03 2018

0.4.1

0.4.1.0

Yii2 gii generator based on schmunk42 yii2-giiant

  Sources   Download

MIT

The Requires

 

by carno

22/02 2018

0.4.0

0.4.0.0

Yii2 gii generator based on schmunk42 yii2-giiant

  Sources   Download

MIT

The Requires

 

by carno

22/02 2018

dev-remove-schmunk42

dev-remove-schmunk42

Yii2 gii generator based on schmunk42 yii2-giiant

  Sources   Download

MIT

The Requires

 

by carno

19/02 2018

0.3.3

0.3.3.0

Yii2 gii generator based on schmunk42 yii2-giiant

  Sources   Download

MIT

The Requires

 

by carno

27/12 2017

0.3.2

0.3.2.0

Yii2 gii generator based on schmunk42 yii2-giiant

  Sources   Download

MIT

The Requires

 

by carno

28/09 2017

0.2.7

0.2.7.0

Yii2 gii generator based on schmunk42 yii2-giiant

  Sources   Download

MIT

The Requires

 

by carno

25/09 2017

0.3.1

0.3.1.0

Yii2 gii generator based on schmunk42 yii2-giiant

  Sources   Download

MIT

The Requires

 

by carno

25/09 2017

0.3.0

0.3.0.0

Yii2 gii generator based on schmunk42 yii2-giiant

  Sources   Download

MIT

The Requires

 

by carno

25/09 2017

dev-class-generators

dev-class-generators

Yii2 gii generator based on schmunk42 yii2-giiant

  Sources   Download

MIT

The Requires

 

by carno

21/08 2017

0.2.6

0.2.6.0

Yii2 gii generator based on schmunk42 yii2-giiant

  Sources   Download

MIT

The Requires

 

by carno

21/08 2017

0.2.5

0.2.5.0

Yii2 gii generator based on schmunk42 yii2-giiant

  Sources   Download

MIT

The Requires

 

by carno

03/08 2017

0.2.4

0.2.4.0

Yii2 gii generator based on schmunk42 yii2-giiant

  Sources   Download

MIT

The Requires

 

by carno

03/08 2017

0.2.3

0.2.3.0

Yii2 gii generator based on schmunk42 yii2-giiant

  Sources   Download

MIT

The Requires

 

by carno

19/07 2017

0.2.2

0.2.2.0

Yii2 gii generator based on schmunk42 yii2-giiant

  Sources   Download

MIT

The Requires

 

by carno

14/07 2017

0.2.1

0.2.1.0

Yii2 gii generator based on schmunk42 yii2-giiant

  Sources   Download

MIT

The Requires

 

by carno

05/07 2017

0.2.0

0.2.0.0

Yii2 gii generator based on schmunk42 yii2-giiant

  Sources   Download

MIT

The Requires

 

by carno

30/01 2017

0.1.3

0.1.3.0

Yii2 gii generator based on schmunk42 yii2-giiant

  Sources   Download

MIT

The Requires

 

by carno

21/12 2016

0.1.2

0.1.2.0

Yii2 gii generator based on schmunk42 yii2-giiant

  Sources   Download

MIT

The Requires

 

by carno

09/12 2016

0.1.1

0.1.1.0

Yii2 gii generator based on schmunk42 yii2-giiant

  Sources   Download

MIT

The Requires

 

by carno

03/12 2016

0.1.0

0.1.0.0

Yii2 gii generator based on schmunk42 yii2-giiant

  Sources   Download

MIT

The Requires

 

by carno