Browse Source

Merge pull request #1853 from creocoder/gii-table-prefix-fix

gii additional table prefix fixes
tags/2.0.0-beta
Qiang Xue 11 years ago
parent
commit
1e7a359cb3
  1. 5
      extensions/yii/gii/generators/model/Generator.php

5
extensions/yii/gii/generators/model/Generator.php

@ -550,13 +550,8 @@ class Generator extends \yii\gii\Generator
}
$patterns[] = '/^' . str_replace('*', '(\w+)', $pattern) . '$/';
}
if (!empty($db->tablePrefix)) {
$patterns[] = "/^{$db->tablePrefix}(.*?)$/";
$patterns[] = "/^(.*?){$db->tablePrefix}$/";
} else {
$patterns[] = "/^tbl_(.*?)$/";
}
$className = $tableName;
foreach ($patterns as $pattern) {
if (preg_match($pattern, $tableName, $matches)) {

Loading…
Cancel
Save