mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 23:22:48 +08:00
修改器和获取器方法支持第三个参数关联数据
This commit is contained in:
@@ -353,7 +353,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
|||||||
// 检测修改器
|
// 检测修改器
|
||||||
$method = 'set' . Loader::parseName($name, 1) . 'Attr';
|
$method = 'set' . Loader::parseName($name, 1) . 'Attr';
|
||||||
if (method_exists($this, $method)) {
|
if (method_exists($this, $method)) {
|
||||||
$value = $this->$method($value, array_merge($this->data, $data));
|
$value = $this->$method($value, array_merge($this->data, $data), $this->relation);
|
||||||
} elseif (isset($this->type[$name])) {
|
} elseif (isset($this->type[$name])) {
|
||||||
// 类型转换
|
// 类型转换
|
||||||
$value = $this->writeTransform($value, $this->type[$name]);
|
$value = $this->writeTransform($value, $this->type[$name]);
|
||||||
@@ -532,7 +532,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
|||||||
// 检测属性获取器
|
// 检测属性获取器
|
||||||
$method = 'get' . Loader::parseName($name, 1) . 'Attr';
|
$method = 'get' . Loader::parseName($name, 1) . 'Attr';
|
||||||
if (method_exists($this, $method)) {
|
if (method_exists($this, $method)) {
|
||||||
$value = $this->$method($value, $this->data);
|
$value = $this->$method($value, $this->data, $this->relation);
|
||||||
} elseif (isset($this->type[$name])) {
|
} elseif (isset($this->type[$name])) {
|
||||||
// 类型转换
|
// 类型转换
|
||||||
$value = $this->readTransform($value, $this->type[$name]);
|
$value = $this->readTransform($value, $this->type[$name]);
|
||||||
|
|||||||
Reference in New Issue
Block a user