改名
This commit is contained in:
@@ -827,7 +827,7 @@ abstract class BaseActiveRecord extends Component implements IOrm, ArrayAccess
|
|||||||
public function refresh(): static
|
public function refresh(): static
|
||||||
{
|
{
|
||||||
$this->_oldAttributes = $this->_attributes;
|
$this->_oldAttributes = $this->_attributes;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -864,16 +864,26 @@ abstract class BaseActiveRecord extends Component implements IOrm, ArrayAccess
|
|||||||
return static::getColumns()->_decode($name, $value);
|
return static::getColumns()->_decode($name, $value);
|
||||||
}
|
}
|
||||||
if (in_array($name, $this->_with)) {
|
if (in_array($name, $this->_with)) {
|
||||||
$data = $this->{$this->_relate[$name]}();
|
return $this->with($name);
|
||||||
if ($data instanceof HasBase) {
|
|
||||||
return $data->get();
|
|
||||||
}
|
|
||||||
return $data;
|
|
||||||
}
|
}
|
||||||
return parent::__get($name);
|
return parent::__get($name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $name
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
private function with($name): mixed
|
||||||
|
{
|
||||||
|
$data = $this->{$this->_relate[$name]}();
|
||||||
|
if ($data instanceof HasBase) {
|
||||||
|
return $data->get();
|
||||||
|
}
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $type
|
* @param string $type
|
||||||
* @return array
|
* @return array
|
||||||
@@ -1032,8 +1042,8 @@ abstract class BaseActiveRecord extends Component implements IOrm, ArrayAccess
|
|||||||
return new $className();
|
return new $className();
|
||||||
});
|
});
|
||||||
$model->_attributes = $data;
|
$model->_attributes = $data;
|
||||||
$model->setIsCreate(false);
|
$model->setIsCreate(false);
|
||||||
$model->refresh();
|
$model->refresh();
|
||||||
return $model;
|
return $model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user