private static function _setWhere($where, QueryBuilder $query, string $primaryKey = "id") : QueryBuilder
    {
        if(!is_array($where)) {
            return $query->where([
                $primaryKey => $where
            ]);
        }

        $columns = $where;

        unset($columns["ORDER BY"]);
        unset($columns["LIMIT"]);
        unset($columns["OFFSET"]);

        if(!empty($columns)) {
            $query->where($columns);
        }

        if(isset($where["ORDER BY"])) {
            $order = $where["ORDER BY"];
            if(!is_array($order)) {
                $order = [$order];
            }

            $query->order(... $order);
        }
        if(isset($where["LIMIT"])) {
            $limit = $where["LIMIT"];
            if(!is_array($limit)) {
                $limit = [$limit];
            }

            $query->limit(... $limit);
        }
        if(isset($where["OFFSET"])) {
            $query->offset($where["OFFSET"]);
        }

        return $query;
    }
private static function _setWhere($where, QueryBuilder $query, string $primaryKey = "id") : QueryBuilder
    {
        if(!is_array($where)) {
            return $query->where([
                $primaryKey => $where
            ]);
        }

        $columns = $where;

        unset($columns["ORDER BY"]);
        unset($columns["LIMIT"]);
        unset($columns["OFFSET"]);

        if(!empty($columns)) {
            $query->where($columns);
        }

        if(isset($where["ORDER BY"])) {
            $order = $where["ORDER BY"];
            if(!is_array($order)) {
                $order = [$order];
            }

            $query->order(... $order);
        }
        if(isset($where["LIMIT"])) {
            $limit = $where["LIMIT"];
            if(!is_array($limit)) {
                $limit = [$limit];
            }

            $query->limit(... $limit);
        }
        if(isset($where["OFFSET"])) {
            $query->offset($where["OFFSET"]);
        }

        return $query;
    }
private static function _setWhere ( $ where , QueryBuilder $ query , string $ primaryKey = "id" ) : QueryBuilder { if ( ! is_array ( $ where ) ) { return $ query -> where ( [ $ primaryKey => $ where ] ) ; } $ columns = $ where ; unset ( $ columns [ "ORDER BY" ] ) ; unset ( $ columns [ "LIMIT" ] ) ; unset ( $ columns [ "OFFSET" ] ) ; if ( ! empty ( $ columns ) ) { $ query -> where ( $ columns ) ; } if ( isset ( $ where [ "ORDER BY" ] ) ) { $ order = $ where [ "ORDER BY" ] ; if ( ! is_array ( $ order ) ) { $ order = [ $ order ] ; } $ query -> order ( ... $ order ) ; } if ( isset ( $ where [ "LIMIT" ] ) ) { $ limit = $ where [ "LIMIT" ] ; if ( ! is_array ( $ limit ) ) { $ limit = [ $ limit ] ; } $ query -> limit ( ... $ limit ) ; } if ( isset ( $ where [ "OFFSET" ] ) ) { $ query -> offset ( $ where [ "OFFSET" ] ) ; } return $ query ; }
Sets the WHERE param to the query.

@param int|array    $where WHERE param.
@param QueryBuilder $query Query to build.
@param string       $primaryKey Table primary key.

@return QueryBuilder Query object.
Sets the WHERE param to the query .