protected function toSql($fields=null) : QueryBuilder
	{
		$queryBuilder = $this->queryBuilder()
		->select($fields)
		->from($this->table);

		$orderBy = [];

		if (isset(Model::$findOptions['asc'])) {
			$orderBy[] = Model::$findOptions['asc'] . ' ASC';
		}

		if (isset(Model::$findOptions['desc'])) {
			$orderBy[] = Model::$findOptions['desc'] . ' DESC';
		}

		if (!empty($orderBy)) {
			$queryBuilder->orderBy($orderBy);
		}

		if (isset(Model::$findOptions['limit'])) {
			$limit = Model::$findOptions['limit'];

			if (is_array($limit) && count($limit) > 1) {
				$queryBuilder->limit($limit[0], $limit[1]);
			}else{
				$queryBuilder->limit($limit);
			}
		}

		return $queryBuilder;
	}
protected function toSql($fields=null) : QueryBuilder
	{
		$queryBuilder = $this->queryBuilder()
		->select($fields)
		->from($this->table);

		$orderBy = [];

		if (isset(Model::$findOptions['asc'])) {
			$orderBy[] = Model::$findOptions['asc'] . ' ASC';
		}

		if (isset(Model::$findOptions['desc'])) {
			$orderBy[] = Model::$findOptions['desc'] . ' DESC';
		}

		if (!empty($orderBy)) {
			$queryBuilder->orderBy($orderBy);
		}

		if (isset(Model::$findOptions['limit'])) {
			$limit = Model::$findOptions['limit'];

			if (is_array($limit) && count($limit) > 1) {
				$queryBuilder->limit($limit[0], $limit[1]);
			}else{
				$queryBuilder->limit($limit);
			}
		}

		return $queryBuilder;
	}
protected function toSql ( $ fields = null ) : QueryBuilder { $ queryBuilder = $ this -> queryBuilder ( ) -> select ( $ fields ) -> from ( $ this -> table ) ; $ orderBy = [ ] ; if ( isset ( Model :: $ findOptions [ 'asc' ] ) ) { $ orderBy [ ] = Model :: $ findOptions [ 'asc' ] . ' ASC' ; } if ( isset ( Model :: $ findOptions [ 'desc' ] ) ) { $ orderBy [ ] = Model :: $ findOptions [ 'desc' ] . ' DESC' ; } if ( ! empty ( $ orderBy ) ) { $ queryBuilder -> orderBy ( $ orderBy ) ; } if ( isset ( Model :: $ findOptions [ 'limit' ] ) ) { $ limit = Model :: $ findOptions [ 'limit' ] ; if ( is_array ( $ limit ) && count ( $ limit ) > 1 ) { $ queryBuilder -> limit ( $ limit [ 0 ] , $ limit [ 1 ] ) ; } else { $ queryBuilder -> limit ( $ limit ) ; } } return $ queryBuilder ; }
Returns a prepared query that will be used by other find methods.

@param 	$fields <Mixed>
@access 	protected
@static
@return 	<Object> <Kit\Glider\Query\Builder\QueryBuilder>
Returns a prepared query that will be used by other find methods .