Skip to content

Commit e42b72e

Browse files
authored
Merge pull request #73 from teamones-open/1.0_complete_model
modify: model自动验证 callback_with_data 忽略不存在的值
2 parents 7bd58ff + 4e7d2dd commit e42b72e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/think/Model.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1725,7 +1725,10 @@ private function autoOperation(&$data, $type)
17251725
$args = isset($auto[4]) ? (array)$auto[4] : [];
17261726
array_unshift($args, $auto[0]);
17271727
array_unshift($args, $data);
1728-
$data[$auto[0]] = call_user_func_array([&$this, $auto[1]], $args);
1728+
$callRes = call_user_func_array([&$this, $auto[1]], $args);
1729+
if ($callRes !== false) {
1730+
$data[$auto[0]] = $callRes;
1731+
}
17291732
break;
17301733
case 'function_with_data':
17311734
// 使用函数进行填充,传入数组值和字段名

0 commit comments

Comments
 (0)