Query类增加failException方法 用于设置查询没有找到数据时候是否抛出异常

This commit is contained in:
thinkphp
2016-04-23 18:16:26 +08:00
parent c772c23cd8
commit 0ed23d6186
2 changed files with 35 additions and 2 deletions

View File

@@ -89,7 +89,7 @@ abstract class Builder
$result = [];
foreach ($data as $key => $val) {
if (!in_array($key, $fields, true)) {
if ($this->connection->getConfig('fields_strict')) {
if ($options['strict']) {
throw new Exception(' fields not exists :[' . $key . ']');
}
} else {
@@ -572,7 +572,7 @@ abstract class Builder
foreach ($dataSet as &$data) {
foreach ($data as $key => $val) {
if (!in_array($key, $fields, true)) {
if ($this->connection->getConfig('fields_strict')) {
if ($options['strict']) {
throw new Exception(' fields not exists :[' . $key . ']');
}
unset($data[$key]);