This commit is contained in:
2021-04-16 21:33:20 +08:00
parent 6e03278a00
commit 52a5722837
+4 -5
View File
@@ -10,14 +10,13 @@ declare(strict_types=1);
namespace Database; namespace Database;
use Exception;
use Database\Base\BaseActiveRecord; use Database\Base\BaseActiveRecord;
use Database\Traits\HasBase;
use Exception;
use ReflectionException; use ReflectionException;
use Snowflake\Channel; use Snowflake\Channel;
use Snowflake\Exception\ComponentException;
use Snowflake\Exception\NotFindClassException; use Snowflake\Exception\NotFindClassException;
use Snowflake\Snowflake; use Snowflake\Snowflake;
use Database\Traits\HasBase;
defined('SAVE_FAIL') or define('SAVE_FAIL', 3227); defined('SAVE_FAIL') or define('SAVE_FAIL', 3227);
defined('FIND_OR_CREATE_MESSAGE') or define('FIND_OR_CREATE_MESSAGE', 'Create a new model, but the data cannot be empty.'); defined('FIND_OR_CREATE_MESSAGE') or define('FIND_OR_CREATE_MESSAGE', 'Create a new model, but the data cannot be empty.');
@@ -220,7 +219,7 @@ class ActiveRecord extends BaseActiveRecord
public static function inserts(array $data): bool public static function inserts(array $data): bool
{ {
/** @var static $class */ /** @var static $class */
$class = Snowflake::createObject(static::className()); $class = Snowflake::createObject(['class' => static::class]);
if (empty($data)) { if (empty($data)) {
return $class->addError('Insert data empty.', 'mysql'); return $class->addError('Insert data empty.', 'mysql');
} }
@@ -321,7 +320,7 @@ class ActiveRecord extends BaseActiveRecord
*/ */
public function recover() public function recover()
{ {
$this->clean(); $this->clean();
/** @var Channel $channel */ /** @var Channel $channel */
$channel = Snowflake::app()->get('channel'); $channel = Snowflake::app()->get('channel');