This commit is contained in:
2021-11-13 04:08:25 +08:00
parent 3e75bdc089
commit 6745036672
+2 -2
View File
@@ -822,8 +822,8 @@ abstract class Model extends Component implements ModelInterface, ArrayAccess, T
throw new Exception('You need add static method `tableName` and return table name.');
}
$table = trim($this->table, '{{%}}');
if (!empty($tablePrefix) && !str_starts_with($this->table, $tablePrefix)) {
$table = $tablePrefix . $this->table;
if (!empty($tablePrefix) && !str_starts_with($table, $tablePrefix)) {
$table = $tablePrefix . $table;
}
return '`' . $connection->database . '`.' . $table;
}