diff --git a/Database/Base/AbstractCollection.php b/Database/Base/AbstractCollection.php index ec9fd1ac..e2848206 100644 --- a/Database/Base/AbstractCollection.php +++ b/Database/Base/AbstractCollection.php @@ -111,7 +111,6 @@ abstract class AbstractCollection extends Component implements \IteratorAggregat /** * @return mixed - * @throws ComponentException * @throws Exception */ public function getModel(): ActiveRecord diff --git a/Database/Base/CollectionIterator.php b/Database/Base/CollectionIterator.php index bf4ef5a1..54d4f3d8 100644 --- a/Database/Base/CollectionIterator.php +++ b/Database/Base/CollectionIterator.php @@ -57,13 +57,7 @@ class CollectionIterator extends \ArrayIterator */ protected function newModel($current): ActiveRecord { - /** @var ActiveRecord|string $model */ - $model = $this->model; - if (is_object($model)) { - $model = get_class($model); - } - $model = new $model(); - return $model->setAttributes($current); + return $this->model::populate($current); }