resultSetType 为array无效

浏览:907 发布日期:2018/06/14
5.0.0 - 普通 - 已关闭
trait Conversion 中    /**
     * 转换数据集为数据集对象
     * @access public
     * @param  array|Collection $collection 数据集
     * @param  string           $resultSetType 数据集类
     * @return Collection
     */
    public function toCollection($collection, $resultSetType = null)
    {
        $resultSetType = $resultSetType ?: $this->resultSetType;

        if ($resultSetType && false !== strpos($resultSetType, '\\')) {
            $collection = new $resultSetType($collection);
        } else {
            $collection = new ModelCollection($collection);
        }

        return $collection;
    }
array 不带\开头 无法设置 为 array

如果使用Collection, 列表为空的的时候不能使用empty来判断为空。
评论()
后面还有条评论,点击查看>>