This commit is contained in:
as2252258@163.com
2021-04-23 03:07:29 +08:00
parent f9210d9971
commit 8b57f44f7e
5 changed files with 3 additions and 79 deletions
+1 -7
View File
@@ -1029,13 +1029,7 @@ abstract class BaseActiveRecord extends Component implements IOrm, ArrayAccess
*/
public static function populate(array $data): static
{
$className = get_called_class();
/** @var Channel $channel */
$channel = Snowflake::app()->get('channel');
$model = $channel->pop($className, function () use ($className) {
return new $className();
});
$model = new static();
$model->_attributes = $data;
$model->setIsCreate(false);
$model->refresh();