Angejia\Pea\QueryBuilder::getNormal PHP Method

getNormal() private method

private getNormal ( )
    private function getNormal()
    {
        $primaryKeyName = $this->model->primaryKey();
        // 查询主键列表
        $rows = $this->getAwful([$primaryKeyName]);
        $ids = array_map(function ($row) use($primaryKeyName) {
            return $row->{$primaryKeyName};
        }, $rows);
        // 没查到结果则直接返回空数组
        if (!$ids) {
            return [];
        }
        // 根据主键查询结果
        $originWheres = $this->wheres;
        $originWhereBindings = $this->bindings['where'];
        $originLimit = $this->limit;
        $originOffset = $this->offset;
        $this->wheres = [];
        $this->bindings['where'] = [];
        $this->limit = null;
        $this->offset = null;
        $this->whereIn($primaryKeyName, $ids);
        $rows = $this->getSimple();
        $this->wheres = $originWheres;
        $this->bindings['where'] = $originWhereBindings;
        $this->limit = $originLimit;
        $this->offset = $originOffset;
        return $rows;
    }