think-orm icon indicating copy to clipboard operation
think-orm copied to clipboard

db before_select 事件的重大bug,无解不能执行下去

Open xuhandong18 opened this issue 5 years ago • 0 comments

before_select事件返回的一定是数组,因为Event类的diaptch,没有加once参数,方法返回的一定是数组. 而执行事件使用的是 if (!$resultSet) 判断结果一定是false,导致真正的查询没有调用

`$resultSet = $this->db->trigger('before_select', $query);

    if (!$resultSet) {
        // 执行查询操作
        $resultSet = $this->pdoQuery($query, function ($query) {
            return $this->builder->select($query);
        });
    }`

xuhandong18 avatar Nov 02 '20 21:11 xuhandong18