model = $model; if (is_string($model)) { $this->model = Snowflake::createObject($model); } $this->query = $query; parent::__construct($array, $flags); } /** * @param $current * @return ActiveRecord * @throws Exception */ protected function newModel($current): ActiveRecord { return (clone $this->model)->setAttributes($current); } /** * @return mixed * @throws Exception */ public function current(): mixed { $current = parent::current(); if (!($current instanceof ActiveRecord)) { $current = $this->newModel($current); } return $this->query->getWith($current); } }