yii2-gii icon indicating copy to clipboard operation
yii2-gii copied to clipboard

[ENH] Add more generators by default

Open pana1990 opened this issue 7 years ago • 4 comments

laravel has some interesting generators, like command, event, policy, etc...

It would be nice if gii included the following generators by default :

  • Command

  • Filter

  • Behaviour

  • Rule

  • Component

  • Event

  • ... any class Frequently used

The generator has to generate esqueleton of class and include any options to custom class

what do you think about it?

pana1990 avatar Apr 16 '17 11:04 pana1990

@pana1990 I think this is a good idea!)

MaksimKiselev avatar Apr 16 '17 15:04 MaksimKiselev

May be a good idea if it's not about generating empty class...

samdark avatar Apr 16 '17 23:04 samdark

@pana1990 can you describe, what these classes could contain or give some examples? Simply creating empty classes that extend from something are much easier created by IDE "create new class" features.

cebe avatar Apr 18 '17 20:04 cebe

@cebe for example :

// Syntax ./yii gii/command <name> <actions>
./yii gii/command TestCommand test1,test2 --options=option1,option2

Generates

<?php

namespace app\commands;

use yii\console\Controller;

class TestCommand extends Controller
{
    public $option1;
    public $option2;

   public function options($actionID)
   {
       return array_merge(parent::options($actionID), [
             'option1',
             'option2'
       ]);
    }
    public function actionTest1()
   {
   
   }

    public function actionTest2()
   {
   
   }
}

This is the idea more or less. For events, Behaviors, filters and other components we could create component generator with attributes options and other commun options

pana1990 avatar Apr 28 '17 10:04 pana1990