public function buildDataRequestQuery(DataRequest $dataRequest, QueryBuilder $queryBuilder, $entity, $tableCode)
    {
        $queryBuilder->select($tableCode)
                     ->from($entity, $tableCode);
        
        $hasWhere = false;
        $i = 1;
        foreach ($dataRequest->getFilters() as $filter) {
            $whereQuery = $tableCode . '.' . $filter->getFieldName() . ' ' . $filter->getMode() . ' :p' . $i;
            if ($hasWhere) {
                $queryBuilder->andWhere($whereQuery);
            } else {
                $queryBuilder->where($whereQuery);
                $hasWhere = true;
            }
            
            $queryBuilder->setParameter('p' . $i, $this->prepareValue($filter->getNeededValue(), $filter->getMode()));
            $i++;
        }
        
        // Sorting
        if ($dataRequest->hasSorting()) {
            $mode = 'ASC';
            if (in_array($dataRequest->getSortByDirection(), array('ASC', 'DESC'))) {
                $mode = $dataRequest->getSortByDirection();
            }
            
            $queryBuilder->orderBy($tableCode . '.' . $dataRequest->getSortBy(), $mode);
        }
        
        // Offset
        if ($dataRequest->hasRange()) {
            $queryBuilder->setFirstResult($dataRequest->getOffset());
            $queryBuilder->setMaxResults($dataRequest->getNumberOfEntries());
        }
    }