mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 15:12:48 +08:00
改进parseData方法的对象处理参数绑定
This commit is contained in:
@@ -98,15 +98,16 @@ abstract class Builder
|
|||||||
$result = [];
|
$result = [];
|
||||||
foreach ($data as $key => $val) {
|
foreach ($data as $key => $val) {
|
||||||
$item = $this->parseKey($key, $options);
|
$item = $this->parseKey($key, $options);
|
||||||
|
if (is_object($val) && method_exists($val, '__toString')) {
|
||||||
|
// 对象数据写入
|
||||||
|
$val = $val->__toString();
|
||||||
|
}
|
||||||
if (false === strpos($key, '.') && !in_array($key, $fields, true)) {
|
if (false === strpos($key, '.') && !in_array($key, $fields, true)) {
|
||||||
if ($options['strict']) {
|
if ($options['strict']) {
|
||||||
throw new Exception('fields not exists:[' . $key . ']');
|
throw new Exception('fields not exists:[' . $key . ']');
|
||||||
}
|
}
|
||||||
} elseif (is_null($val)) {
|
} elseif (is_null($val)) {
|
||||||
$result[$item] = 'NULL';
|
$result[$item] = 'NULL';
|
||||||
} elseif (is_object($val) && method_exists($val, '__toString')) {
|
|
||||||
// 对象数据写入
|
|
||||||
$result[$item] = $val->__toString();
|
|
||||||
} elseif (isset($val[0]) && 'exp' == $val[0]) {
|
} elseif (isset($val[0]) && 'exp' == $val[0]) {
|
||||||
$result[$item] = $val[1];
|
$result[$item] = $val[1];
|
||||||
} elseif (is_scalar($val)) {
|
} elseif (is_scalar($val)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user