Commit 65519ffb by Alexander Makarov

Enh #6857: Added `yii\gii\Module::$ignoreTables` that allows you to ignore…

Enh #6857: Added `yii\gii\Module::$ignoreTables` that allows you to ignore tables during model generation using `*` (reverted from commit e562f8e4)
parent 5ab1d1a0
...@@ -4,7 +4,7 @@ Yii Framework 2 gii extension Change Log ...@@ -4,7 +4,7 @@ Yii Framework 2 gii extension Change Log
2.0.3 under development 2.0.3 under development
----------------------- -----------------------
- Enh #6857: Added `yii\gii\Module::$ignoreTables` that allows you to ignore tables during model generation using `*` (thiagotalma) - no changes in this release.
2.0.2 January 11, 2015 2.0.2 January 11, 2015
......
...@@ -77,11 +77,6 @@ class Module extends \yii\base\Module implements BootstrapInterface ...@@ -77,11 +77,6 @@ class Module extends \yii\base\Module implements BootstrapInterface
* Defaults to 0777, meaning the directory can be read, written and executed by all users. * Defaults to 0777, meaning the directory can be read, written and executed by all users.
*/ */
public $newDirMode = 0777; public $newDirMode = 0777;
/**
* @var array the list of table names to be ignored.
* @since 2.0.3
*/
public $ignoreTables = [];
/** /**
......
...@@ -525,7 +525,6 @@ class Generator extends \yii\gii\Generator ...@@ -525,7 +525,6 @@ class Generator extends \yii\gii\Generator
} }
$tableNames = []; $tableNames = [];
if (strpos($this->tableName, '*') !== false) { if (strpos($this->tableName, '*') !== false) {
$module = Yii::$app->controller->module;
if (($pos = strrpos($this->tableName, '.')) !== false) { if (($pos = strrpos($this->tableName, '.')) !== false) {
$schema = substr($this->tableName, 0, $pos); $schema = substr($this->tableName, 0, $pos);
$pattern = '/^' . str_replace('*', '\w+', substr($this->tableName, $pos + 1)) . '$/'; $pattern = '/^' . str_replace('*', '\w+', substr($this->tableName, $pos + 1)) . '$/';
...@@ -535,10 +534,6 @@ class Generator extends \yii\gii\Generator ...@@ -535,10 +534,6 @@ class Generator extends \yii\gii\Generator
} }
foreach ($db->schema->getTableNames($schema) as $table) { foreach ($db->schema->getTableNames($schema) as $table) {
if (in_array($table, $module->ignoreTables)) {
continue;
}
if (preg_match($pattern, $table)) { if (preg_match($pattern, $table)) {
$tableNames[] = $schema === '' ? $table : ($schema . '.' . $table); $tableNames[] = $schema === '' ? $table : ($schema . '.' . $table);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment