Returns parameter builder
@return Query
494879
public function getQuery()
	{
		if (!$this->query) {
			$this->query = new Query($this->driver, $this->preprocessor);
		}

		return $this->query;
	}
659234
public function fetchCol($query, array $parameters = array())
    {
        $parameters = $this->parameterTransformer->transform($parameters);
        return $this->db->fetchCol($query, $parameters);
    }
1231224
public function createQuery()
    {
        $query = new Query($this->objectType);
        if ($this->defaultOrderings) {
            $query->setOrderings($this->defaultOrderings);
        }
        return $query;
    }
1094479
protected function newBaseQueryBuilder()
    {
        $conn = $this->getConnection();

        $grammar = $conn->getQueryGrammar();

        $builder = new QueryBuilder($conn, $grammar, $conn->getPostProcessor(), $this);

        if (static::rememberable()) {
            $builder->remember(-1);
        }

        return $builder;
    }
324323
public function getQuery()
    {
        // prevent duplicated execution
        if (null === $this->query && $this->model) {
            $this->initQuery()
                 ->applyFilters()
                 ->applySorting();

            $this->query = $this->assembler()->getQuery();
        }

        return $this->query;
    }
786098
private function buildCountParameter() {
        $parameter = new Swagger\Parameter();
        $parameter->setName('count');
        $parameter->setDescription('How many records to retrieve from the start point. Optional.');
        $parameter->setParamType('query');
        $parameter->setType('integer');

        return $parameter;
    }
362307
public function getDefaultQueryBuilder()
    {
        $em = $this->getEntityManager();
        return $em->createQueryBuilder()
            ->select('n')
            ->from($this->getClassname(), 'n');
    }
855190
public function buildQuery() 
    {
        $qb = $this->dataGrid->getQueryBuilder();

        if (!$qb instanceof QueryBuilder){
            throw new \InvalidArgumentException('Value must be instance of Doctrine\ORM\QueryBuilder.');
        }
        
        $options = $this->getOptions();
        
        // Is dependant grid ?
        if ($this->dataGrid->isDependentGrid()) {
            $qb->setParameter('masterGridRowId', $options['masterGridRowId']);
        }
        
        // Orders the records
        if ($options['orderBy']) {
            $qb->addOrderBy($options['orderBy'], $options['sort']);
        }
        
        // Applying search filters
        if ($options['search'] && !empty($options['filters'])) {
            $this->applyFilters($qb, $options['filters']);
        }
        
        // dispatch should onQueryBuilderReady event here
        
        if (!$this->dataGrid->isSortableEnabled() && $options['page'] && $options['records']){
            $qb->setMaxResults($options['records']);
            $qb->setFirstResult(($options['page'] - 1) * $options['records']);
        }

        $this->setQuery($qb->getQuery());
        
        // Getting count
        $paginator = new Paginator($this->getQuery());
        //$paginator->setUseOutputWalkers(false);
        $this->setCount($paginator->count());
        
        return $this;
    }
258287
protected function getQueryBuilderForDemand(): QueryBuilder
    {
        $queryBuilder = $this->getQueryBuilder();
        $queryBuilder
            ->select('*')
            ->from('sys_redirect')
            ->orderBy('source_host')
            ->addOrderBy('source_path');

        $constraints = [];
        if ($this->demand->hasSourceHost()) {
            $constraints[] =$queryBuilder->expr()->eq(
                'source_host',
                $queryBuilder->createNamedParameter($this->demand->getSourceHost(), \PDO::PARAM_STR)
            );
        }

        if ($this->demand->hasSourcePath()) {
            $escapedLikeString = '%' . $queryBuilder->escapeLikeWildcards($this->demand->getSourcePath()) . '%';
            $constraints[] = $queryBuilder->expr()->like(
                'source_path',
                $queryBuilder->createNamedParameter($escapedLikeString, \PDO::PARAM_STR)
            );
        }

        if ($this->demand->hasTarget()) {
            $escapedLikeString = '%' . $queryBuilder->escapeLikeWildcards($this->demand->getTarget()) . '%';
            $constraints[] = $queryBuilder->expr()->like(
                'target',
                $queryBuilder->createNamedParameter($escapedLikeString, \PDO::PARAM_STR)
            );
        }

        if ($this->demand->hasStatusCode()) {
            $constraints[] =$queryBuilder->expr()->eq(
                'target_statuscode',
                $queryBuilder->createNamedParameter($this->demand->getStatusCode(), \PDO::PARAM_INT)
            );
        }

        if (!empty($constraints)) {
            $queryBuilder->where(...$constraints);
        }
        return $queryBuilder;
    }
1203724
protected function createFindQuery(): QueryBuilder
    {
        $query = $this->connection->createQueryBuilder();
        $query
            ->select('id', 'locale', 'name', 'disabled')
            ->from('ezcontent_language');

        return $query;
    }
27702
public function getQuery()
    {

        $strings = $this->string;
        $query = $this->buildQuery($this->getPattern($this->getChieldPattern()), $strings);

        return $query;
    }
116212
public function newQuery()
    {
        $builder = new self($this->mapper, $this->adapter);

        return $this->applyGlobalScopes($builder);
    }
843905
public function getQueryParameters() {
        $params = array();
        if (isset($this->optional['filter']))
            $params['filter'] = $this->optional['filter'];
        if (isset($this->optional['count']))
            $params['count'] = $this->optional['count'];
        if (isset($this->optional['offset']))
            $params['offset'] = $this->optional['offset'];
        if (isset($this->optional['returnProperties']))
            $params['returnProperties'] = $this->optional['returnProperties'];
        if (isset($this->optional['includedProperties']))
            $params['includedProperties'] = $this->optional['includedProperties'];
        return $params;
    }
696125
public function whereParameters()
    {
        return array_filter(
            $this->queryParameters,
            function ($queryParameter) {
                $key = $queryParameter['key'];
                return (! in_array($key, $this->predefinedParams));
            }
        );
    }
1166503
private function filter(Builder $query): Builder
    {
        $filters = $this->entity->getFilters();

        foreach ($filters as $filter) {
            $query = $filter->filter($query);
        }

        return $query;
    }
1039076
public function buildQuery() 
    {
        $qb = $this->dataGrid->getQueryBuilder();

        if (!$qb instanceof QueryBuilder){
            throw new \InvalidArgumentException('Value must be instance of Doctrine\ORM\QueryBuilder.');
        }
        
        $options = $this->getOptions();
        
        // Is dependant grid ?
        if ($this->dataGrid->isDependentGrid()) {
            $qb->setParameter('masterGridRowId', $options['masterGridRowId']);
        }
        
        
        
        // Applying search filters
        if ($options['search'] && !empty($options['filters'])) {
            $this->applyFilters($qb, $options['filters']);
        }
        
        
        // Orders the records
        if ($options['orderBy']) {
            $qb->addOrderBy($options['orderBy'], $options['sort']);
        }
        
        if (!$this->dataGrid->isSortableEnabled() && $options['page'] && $options['records']){
            $qb->setMaxResults($options['records']);
            $qb->setFirstResult(($options['page'] - 1) * $options['records']);
        }

        $queryBuilderEvent = new QueryBuilderEvent($this->dataGrid->getName(), $qb);
        $this->dispatcher->dispatch(DataGridEvents::onQueryBuilderReady, $queryBuilderEvent);
        
        $this->setQuery($queryBuilderEvent->getQueryBuilder()->getQuery());
        
        // Getting count
        $paginator = new Paginator($this->getQuery());
        //$paginator->setUseOutputWalkers(false);
        $this->setCount($paginator->count());
        
        return $this;
    }
324306
private function _buildQueryParams() {
		$query = [];

		$this->_where = is_array($this->_where) ? $this->_where : [];
		foreach ($this->_where as $key => $val) {
			$query[$key] = is_numeric($val) ? (int) $val : $val;
		}

		if(count($this->_select)) {
			$query[$this->selectFieldsKey] = implode(',', $this->_select);
		}
		if($this->_limit !== null) {
			$query[$this->limitKey] = $this->_limit;
		}
		if($this->_offset !== null) {
			$query[$this->offsetKey] = $this->_offset;
		}

		return $query;
	}