model = $model; parent::__construct($array, $flags); } /** * @param $current * @return ModelInterface * @throws Exception */ protected function newModel($current): ModelInterface { return $this->model->populates($current); } /** * @throws Exception */ public function current(): ModelInterface { if (is_array($current = parent::current())) { $current = $this->newModel($current); } return $current; } }