This commit is contained in:
2020-09-11 18:04:46 +08:00
parent 4dc451fe7a
commit 42623eadc7
+5 -1
View File
@@ -49,9 +49,13 @@ class ActiveQuery extends Component
* Comply constructor.
* @param $model
* @param array $config
* @throws
*/
public function __construct($model, $config = [])
{
if (!is_object($model)) {
$model = Snowflake::createObject($model);
}
$this->modelClass = $model;
parent::__construct($config);
}
@@ -139,7 +143,7 @@ class ActiveQuery extends Component
if (empty($data)) {
return NULL;
}
$newModel = Snowflake::createObject($this->modelClass);
$newModel = $this->modelClass;
$newModel = $this->populate($newModel, $data);
if ($this->asArray) {
return $newModel->toArray();