С версии: 1.0
Автор: Tobais Munk (schmunk@usrbin.de)
Наследование: extends yii\gii\generators\crud\Generator
Пример #1
0
 /**
  * Run batch process to generate CRUDs all given tables
  * @throws \yii\console\Exception
  */
 public function actionCruds()
 {
     // create CRUDs
     $providers = ArrayHelper::merge($this->crudProviders, Generator::getCoreProviders());
     // create folders
     $this->createDirectoryFromNamespace($this->crudControllerNamespace);
     $this->createDirectoryFromNamespace($this->crudSearchModelNamespace);
     foreach ($this->tables as $table) {
         $table = str_replace($this->tablePrefix, '', $table);
         $name = isset($this->tableNameMap[$table]) ? $this->tableNameMap[$table] : $this->modelGenerator->generateClassName($table);
         $params = ['interactive' => $this->interactive, 'overwrite' => $this->overwrite, 'template' => $this->template, 'modelClass' => $this->modelNamespace . '\\' . $name, 'searchModelClass' => $this->crudSearchModelNamespace . '\\' . $name . $this->crudSearchModelSuffix, 'controllerNs' => $this->crudControllerNamespace, 'controllerClass' => $this->crudControllerNamespace . '\\' . $name . 'Controller', 'viewPath' => $this->crudViewPath, 'pathPrefix' => $this->crudPathPrefix, 'tablePrefix' => $this->tablePrefix, 'enableI18N' => $this->enableI18N, 'singularEntities' => $this->singularEntities, 'messageCategory' => $this->messageCategory, 'actionButtonClass' => 'yii\\grid\\ActionColumn', 'baseControllerClass' => $this->crudBaseControllerClass, 'providerList' => $providers, 'skipRelations' => $this->crudSkipRelations, 'accessFilter' => $this->crudAccessFilter, 'tidyOutput' => $this->crudTidyOutput];
         $route = 'gii/giiant-crud';
         $app = \Yii::$app;
         $temp = new \yii\console\Application($this->appConfig);
         $temp->runAction(ltrim($route, '/'), $params);
         unset($temp);
         \Yii::$app = $app;
         \Yii::$app->log->logger->flush(true);
     }
 }