This commit is contained in:
2021-03-05 18:17:01 +08:00
parent 8d9e3756c7
commit 6849212c7f
+12 -2
View File
@@ -864,14 +864,24 @@ abstract class BaseActiveRecord extends Component implements IOrm, ArrayAccess
return static::getColumns()->_decode($name, $value);
}
if (in_array($name, $this->_with)) {
return $this->with($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;
}
return parent::__get($name);
}
/**