This commit is contained in:
2021-04-26 13:57:13 +08:00
parent d1e3a3017b
commit 76f9688ea6
3 changed files with 8 additions and 5 deletions
+4 -1
View File
@@ -1060,8 +1060,11 @@ abstract class BaseActiveRecord extends Component implements IOrm, ArrayAccess
*/
public static function populate(array $data): static
{
$class = Snowflake::app()->getChannel();
/** @var static $model */
$model = Snowflake::createObject(static::class);
$model = $class->pop(static::class, function () {
return new static();
});
$model->_attributes = $data;
$model->_oldAttributes = $data;
$model->setIsCreate(false);