tp5对mongodb的支持的bug

浏览:816 发布日期:2017/03/09 分类:ThinkPHP5专区 关键字: tp5 mongodb
1.Model->save($data = [], $where = [], $sequence = null):
如果$data为空数组,则不进行validate,设置require的属性将无法检测
2.Model->readTransform($value, $type)
当设置字段为object类型时,写入数据中是对象.
但在读取的时候,却提示json_decode() expects parameter 1 to be string, array given
是因为$value是对象,却没有判断,直接当做字符串
case 'object':
$value = empty($value) ? new \stdClass() : json_decode($value);
break;
3.字段类型array
如果字段类型为array,则会被转化为json,但是mongodb支持数组.代码如下,'array'之后没有break;
case 'array':
$value = (array) $value;
case 'json':
最佳答案
评论( 相关
后面还有条评论,点击查看>>