modify
This commit is contained in:
@@ -120,12 +120,7 @@ abstract class AbstractCollection extends Component implements \IteratorAggregat
|
||||
if (is_object($model)) {
|
||||
return $model;
|
||||
}
|
||||
|
||||
/** @var Channel $channel */
|
||||
$channel = Snowflake::app()->get('channel');
|
||||
return $channel->pop($model, function () use ($model) {
|
||||
return new $model();
|
||||
});
|
||||
return new $model();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -62,12 +62,7 @@ class CollectionIterator extends \ArrayIterator
|
||||
if (is_object($model)) {
|
||||
$model = get_class($model);
|
||||
}
|
||||
|
||||
/** @var Channel $channel */
|
||||
$channel = Snowflake::app()->get('channel');
|
||||
$model = $channel->pop($model, function () use ($model) {
|
||||
return new $model();
|
||||
});
|
||||
$model = new $model();
|
||||
return $model->setAttributes($current);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user