diff --git a/Database/ActiveRecord.php b/Database/ActiveRecord.php index 4539dc02..18c55f35 100644 --- a/Database/ActiveRecord.php +++ b/Database/ActiveRecord.php @@ -313,8 +313,8 @@ class ActiveRecord extends BaseActiveRecord } $data = array_merge($data, $this->runRelate()); -// $class = Snowflake::app()->getChannel(); -// $class->push($this, static::class); + $class = Snowflake::app()->getChannel(); + $class->push($this, static::class); return $data; } diff --git a/Database/Base/BaseActiveRecord.php b/Database/Base/BaseActiveRecord.php index 1bc854f6..ca436fe0 100644 --- a/Database/Base/BaseActiveRecord.php +++ b/Database/Base/BaseActiveRecord.php @@ -1036,12 +1036,11 @@ abstract class BaseActiveRecord extends Component implements IOrm, ArrayAccess */ public static function populate(array $data): static { -// $class = Snowflake::app()->getChannel(); -// /** @var static $model */ -// $model = $class->pop(static::class, function () { -// return new static(); -// }); - $model = new static(); + $class = Snowflake::app()->getChannel(); + /** @var static $model */ + $model = $class->pop(static::class, function () { + return new static(); + }); $model->_attributes = $data; $model->_oldAttributes = $data; $model->setIsCreate(false);