mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Consolidate table prefix removal.
This commit is contained in:
parent
c5d763773c
commit
169b0a5c3f
1 changed files with 7 additions and 3 deletions
|
@ -257,7 +257,7 @@ class CakeSchema extends Object {
|
|||
if ($prefix && strpos($table, $prefix) !== 0) {
|
||||
continue;
|
||||
}
|
||||
$table = preg_replace('/^' . preg_quote($prefix) . '/', '', $table);
|
||||
$table = $this->_noPrefixTable($prefix, $table);
|
||||
|
||||
if (in_array($fulltable, $currentTables)) {
|
||||
$key = array_search($fulltable, $currentTables);
|
||||
|
@ -279,7 +279,7 @@ class CakeSchema extends Object {
|
|||
}
|
||||
if (in_array($withTable, $currentTables)) {
|
||||
$key = array_search($withTable, $currentTables);
|
||||
$noPrefixWith = str_replace($prefix, '', $withTable);
|
||||
$noPrefixWith = $this->_noPrefixTable($prefix, $withTable);
|
||||
|
||||
$tables[$noPrefixWith] = $this->__columns($Object->$class);
|
||||
$tables[$noPrefixWith]['indexes'] = $db->index($Object->$class);
|
||||
|
@ -300,7 +300,7 @@ class CakeSchema extends Object {
|
|||
if (strpos($table, $prefix) !== 0) {
|
||||
continue;
|
||||
}
|
||||
$table = preg_replace('/^' . preg_quote($prefix) . '/', '', $table);
|
||||
$table = $this->_noPrefixTable($prefix, $table);
|
||||
}
|
||||
$Object = new AppModel(array(
|
||||
'name' => Inflector::classify($table), 'table' => $table, 'ds' => $connection
|
||||
|
@ -695,4 +695,8 @@ class CakeSchema extends Object {
|
|||
}
|
||||
return array_filter(compact('add', 'drop'));
|
||||
}
|
||||
|
||||
function _noPrefixTable($prefix, $table) {
|
||||
return preg_replace('/^' . preg_quote($prefix) . '/', '', $table);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue