yii2-gii
yii2-gii copied to clipboard
[ENH] Add more generators by default
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 I think this is a good idea!)
May be a good idea if it's not about generating empty class...
@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 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