model = $model; $this->query = $query; parent::__construct($array, $flags); } /** * @param $current * @return ActiveRecord * @throws Exception */ protected function newModel($current): ActiveRecord { $object = Snowflake::app()->getObject(); $model = $object->get($this->model, false); return $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); } }