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