Skip to content

Commit

Permalink
Remove categoryPrefix from tables.
Browse files Browse the repository at this point in the history
  • Loading branch information
lajax committed Feb 12, 2016
1 parent 468133b commit 3456dcc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
1 change: 0 additions & 1 deletion Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
* 'table' => '{{%language}}', // table name
* 'columns' => ['name', 'name_ascii'], //names of multilingual fields
* 'category' => 'database-table-name', // the category is the database table name
* 'categoryPrefix' => 'lx-'
* ]
* ]
* ],
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ A more complex example including database table with multilingual support is bel
'table' => '{{%language}}', // table name
'columns' => ['name', 'name_ascii'],// names of multilingual fields
'category' => 'database-table-name',// the category is the database table name
'categoryPrefix' => 'lx-' //
]
]
],
Expand Down Expand Up @@ -311,6 +310,10 @@ class Category extends \yii\db\ActiveRecord {
Language::saveMessage($this->name);
Language::saveMessage($this->description);

// or If the category is the database table name.
// Language::saveMessage($this->name, static::tableName());
// Language::saveMessage($this->description, static::tableName());

return true;
}

Expand Down
4 changes: 1 addition & 3 deletions services/scanners/ScannerDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
* 'table' => '{{%language}}',
* 'columns' => ['name', 'name_ascii'],
* 'category' => 'database-table-name',
* 'categoryPrefix' => 'lx-'
* ],
* [
* 'connection' => 'db',
Expand Down Expand Up @@ -106,8 +105,7 @@ private function _scanningTable($tables) {
*/
private function _getCategory($tables) {
if (isset($tables['category']) && $tables['category'] == 'database-table-name') {
$tableName = $this->_normalizeTablename($tables['table']);
$category = (isset($tables['categoryPrefix'])) ? $tables['categoryPrefix'] . $tableName : $tableName;
$category = $this->_normalizeTablename($tables['table']);
} else {
$category = Scanner::CATEGORY_DATABASE;
}
Expand Down

0 comments on commit 3456dcc

Please sign in to comment.