改名
This commit is contained in:
@@ -540,7 +540,7 @@ abstract class BaseActiveRecord extends Component implements IOrm, ArrayAccess
|
|||||||
$validate = Validator::getInstance();
|
$validate = Validator::getInstance();
|
||||||
$validate->setParams($this->_attributes);
|
$validate->setParams($this->_attributes);
|
||||||
$validate->setModel($this);
|
$validate->setModel($this);
|
||||||
foreach ($rule as $Key => $val) {
|
foreach ($rule as $val) {
|
||||||
$field = array_shift($val);
|
$field = array_shift($val);
|
||||||
if (empty($val)) {
|
if (empty($val)) {
|
||||||
continue;
|
continue;
|
||||||
@@ -696,15 +696,8 @@ abstract class BaseActiveRecord extends Component implements IOrm, ArrayAccess
|
|||||||
if (empty($table)) {
|
if (empty($table)) {
|
||||||
throw new Exception('You need add static method `tableName` and return table name.');
|
throw new Exception('You need add static method `tableName` and return table name.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (str_starts_with($table, $tablePrefix)) {
|
|
||||||
return '`' . static::getDbName() . '`.' . $table;
|
|
||||||
} else if (!str_starts_with($table, '{{%')) {
|
|
||||||
return '`' . static::getDbName() . '`.' . $table;
|
|
||||||
}
|
|
||||||
|
|
||||||
$table = trim($table, '{{%}}');
|
$table = trim($table, '{{%}}');
|
||||||
if ($tablePrefix) {
|
if (!empty($tablePrefix) && !str_starts_with($table, $tablePrefix)) {
|
||||||
$table = $tablePrefix . $table;
|
$table = $tablePrefix . $table;
|
||||||
}
|
}
|
||||||
return '`' . static::getDbName() . '`.' . $table;
|
return '`' . static::getDbName() . '`.' . $table;
|
||||||
|
|||||||
Reference in New Issue
Block a user