yiisoft/yii2 — pull request #5687 by execut (2014-10-22 05:53:26+00:00)
Title: Re-initialize the generators in beforeAction

when we call gii module twice, there is an attempt to re-initialize the generators in beforeAction
bug example:
```php
namespace console\controllers;

use yii\console\Controller;
class GenerateModelsController extends Controller {
public function actionIndex() {
$modelsList = [
'common\modules\catalog\models\CarsMarks',
];
foreach ($modelsList as $modelClass => $modelConfig) {
if (is_string($modelConfig)) {
$modelClass = $modelConfig;
$modelConfig = [];
}

$classParts = explode('\\', $modelClass);
$messageCategory = implode('.', $classParts);
$defaultConfig = [
'baseClass' => 'execut\yii\db\ActiveRecord',
'enableI18N' => 1,
'messageCategory' => $messageCategory,
'modelClass' => $classParts[count($classParts) - 1],
'ns' => implode('\\', array_splice($classParts, 0, count($classParts) - 1)) . '\base',
'overwrite' => 1,
'tableName' => \yii\helpers\Inflector::camel2id($classParts[0], '_'),
'interactive' => 0,
];

$config = array_merge($defaultConfig, $modelConfig);

$this->run('gii/model', $config);
}
}
}
```