改名
This commit is contained in:
@@ -114,7 +114,6 @@ class ActiveRecord extends BaseActiveRecord
|
|||||||
* @param array $condition
|
* @param array $condition
|
||||||
* @param array $attributes
|
* @param array $attributes
|
||||||
* @return bool|ActiveRecord
|
* @return bool|ActiveRecord
|
||||||
* @throws ComponentException
|
|
||||||
* @throws ReflectionException
|
* @throws ReflectionException
|
||||||
* @throws NotFindClassException
|
* @throws NotFindClassException
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
|
|||||||
@@ -10,32 +10,29 @@ declare(strict_types=1);
|
|||||||
namespace Database\Base;
|
namespace Database\Base;
|
||||||
|
|
||||||
|
|
||||||
use Annotation\Aspect;
|
|
||||||
use Annotation\Event;
|
use Annotation\Event;
|
||||||
use Annotation\Inject;
|
use Annotation\Inject;
|
||||||
use ArrayAccess;
|
use ArrayAccess;
|
||||||
use Database\InjectProperty;
|
|
||||||
use Database\SqlBuilder;
|
|
||||||
use Database\Traits\HasBase;
|
|
||||||
use HttpServer\Http\Context;
|
|
||||||
use ReflectionException;
|
|
||||||
use Snowflake\Abstracts\Component;
|
|
||||||
use Database\ActiveQuery;
|
use Database\ActiveQuery;
|
||||||
use Database\ActiveRecord;
|
use Database\ActiveRecord;
|
||||||
use Database\Connection;
|
use Database\Connection;
|
||||||
use Database\HasMany;
|
use Database\HasMany;
|
||||||
use Database\HasOne;
|
use Database\HasOne;
|
||||||
|
use Database\IOrm;
|
||||||
use Database\Mysql\Columns;
|
use Database\Mysql\Columns;
|
||||||
use Database\Relation;
|
use Database\Relation;
|
||||||
|
use Database\SqlBuilder;
|
||||||
|
use Database\Traits\HasBase;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
use HttpServer\Http\Context;
|
||||||
|
use ReflectionException;
|
||||||
|
use Snowflake\Abstracts\Component;
|
||||||
use Snowflake\Abstracts\TraitApplication;
|
use Snowflake\Abstracts\TraitApplication;
|
||||||
use Snowflake\Channel;
|
use Snowflake\Channel;
|
||||||
use Snowflake\Exception\ComponentException;
|
|
||||||
use Snowflake\Exception\NotFindClassException;
|
|
||||||
use validator\Validator;
|
|
||||||
use Database\IOrm;
|
|
||||||
use Snowflake\Snowflake;
|
|
||||||
use Snowflake\Event as SEvent;
|
use Snowflake\Event as SEvent;
|
||||||
|
use Snowflake\Exception\NotFindClassException;
|
||||||
|
use Snowflake\Snowflake;
|
||||||
|
use validator\Validator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class BOrm
|
* Class BOrm
|
||||||
@@ -768,14 +765,14 @@ abstract class BaseActiveRecord extends Component implements IOrm, ArrayAccess
|
|||||||
$tablePrefix = static::getDb()->tablePrefix;
|
$tablePrefix = static::getDb()->tablePrefix;
|
||||||
|
|
||||||
$table = static::tableName();
|
$table = static::tableName();
|
||||||
|
if (empty($table)) {
|
||||||
|
throw new Exception('You need add static method `tableName` and return table name.');
|
||||||
|
}
|
||||||
|
|
||||||
if (str_starts_with($table, $tablePrefix)) {
|
if (str_starts_with($table, $tablePrefix)) {
|
||||||
return $table;
|
return $table;
|
||||||
}
|
} else if (!str_starts_with($table, '{{%')) {
|
||||||
|
return $table;
|
||||||
if (empty($table)) {
|
|
||||||
$class = preg_replace('/model\\\\/', '', get_called_class());
|
|
||||||
$table = lcfirst($class);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$table = trim($table, '{{%}}');
|
$table = trim($table, '{{%}}');
|
||||||
|
|||||||
Reference in New Issue
Block a user