This commit is contained in:
2021-02-24 14:22:56 +08:00
parent c704dc05eb
commit 19775e937e
7 changed files with 35 additions and 18 deletions
+7 -1
View File
@@ -114,7 +114,13 @@ abstract class AbstractCollection extends Component implements \IteratorAggregat
*/
public function getModel(): ActiveRecord
{
return objectPool($this->model);
$model = $this->model;;
if (is_object($model)) {
return $model;
}
return objectPool($model, function () use ($model) {
return new $model();
});
}