@param Content      $content Content model
@param QueryBuilder $builder Query builder

@return Collection|LengthAwarePaginator
763364
public function getManyChildren(Content $content, QueryBuilder $builder)
    {
        return $this->getManyFrom($content->children()->newQuery()->getQuery(), $builder);
    }
1004772
private function modifyQueryBuilder(QueryBuilder $queryBuilder, SpecificationInterface $specification)
    {
        $condition = $specification->modify($queryBuilder, $this->dqlAlias);

        if (empty($condition)) {
            return;
        }

        $queryBuilder->where($condition);
    }
686285
public function setQueryBuilder(\pwf\components\querybuilder\interfaces\SelectBuilder $builder)
    {
        $this->queryBuilder = $builder;
        return $this;
    }
250432
static function FirstChildOf (Content $content)
    {
        $provider = self::GetTreeProvider($content);
        if (!$provider)
        {
            return null;
        }
        $item = $provider->ItemByContent($content);
        return $provider->ContentByItem($provider->FirstChildOf($item));
    }
244484
public function setContent(Content $content)
    {
        $this->contentTypeName = $content->getType()->getName();
        $this->contentId = $content->getContentId();

        return parent::setContent($content);
    }
1234977
public function fetchResources(QueryBuilder $builder, string $modelClass): PaginatedDataInterface
    {
        $data = $this->fetchPaginatedResourcesWithoutRelationships($builder, $modelClass);

        if ($this->hasIncludes() === true) {
            $this->loadRelationships($data);
            $this->clearFetchParameters();
        }

        return $data;
    }
289314
protected function exportableQuery(Builder $query): Builder
    {
        // Allow executing custom exportable query.
        if (method_exists($this->module, 'exportableQuery')) {
            return $this->module->exportableQuery($query);
        }

        return $query
            ->when($query->getModel() instanceof Translatable, function ($query) {
                $query->translated();
            })
            // leave select after joining with translations
            // table in order to rewrite selected columns
            ->select($this->exportableColumns());
    }
256683
public function getQueryBuilderWithoutSecurity(QueryBuilder $queryBuilder)
    {
        $queryBuilder->addSelect('fileVersion')
            ->addSelect('file')
            ->addSelect('media')
            ->addSelect('collection')
            ->leftJoin('d.fileVersion', 'fileVersion')
            ->leftJoin('fileVersion.file', 'file')
            ->leftJoin('file.media', 'media')
            ->leftJoin('media.collection', 'collection')
            ->leftJoin(
                AccessControl::class,
                'accessControl',
                'WITH',
                'accessControl.entityClass = :entityClass AND accessControl.entityId = collection.id'
            )
            ->where('file.version = fileVersion.version')
            ->andWhere('accessControl.id is null')
            ->setParameter('entityClass', Collection::class);

        return $queryBuilder;
    }
874140
public function getQueryBuilder($entity): QueryBuilderInterface
    {
        $metaInformation = $this->metaInformationFactory->loadInformation($entity);

        return new QueryBuilder($this, $metaInformation);
    }
328343
protected function addPagination(QueryBuilder $queryBuilder, $elementsPerPage, $page = 1)
    {
        $elementsPerPage = (int)$elementsPerPage;
        $page = (int)$page;

        return $queryBuilder
            ->setMaxResults($elementsPerPage)
            ->setFirstResult($elementsPerPage * ($page - 1));
    }
607542
public function serialyse(QueryBuilderInterface $Builder) {
        $this->parsedQuery = $this->getSerialyser()->setCriteriaList($Builder)->serialyse();
        return $this;
    }
1163548
protected function resolveQueryFor(Builder $builder, string $filter) : Builder
    {
        $factory = $this->allowed[$filter];

        $input = $this->wantsByPrices($filter)
            ? $this->prices()
            : $this->request[$filter];

    	return (new $factory($input, $builder))->query();
    }
342980
public function buildContent(Model\ContentInterface $content)
    {
        $view = new ContentView();
        $attributes = $view->getAttributes()->addClass('cms-content');

        if ($this->editor->isEnabled()) {
            $attributes
                ->setId('cms-content-' . $content->getId())
                ->setData([
                    'id'      => $content->getId(),
                    'actions' => [
                        // TODO
                    ],
                ]);
        }

        // Layout
        $this->editor->getLayoutAdapter()->buildContent($content, $view);

        foreach ($content->getContainers() as $container) {
            $view->containers[] = $this->buildContainer($container);
        }

        return $view;
    }
201481
public function getManyFiles(Block $block, QueryBuilder $builder): LengthAwarePaginator
    {
        $query = $block->files(false)->with(['type','translations']);

        $count = clone $query->getQuery();

        $results = $query->limit($builder->getPageSize())
            ->offset($builder->getPageSize() * ($builder->getPage() - 1))
            ->get(['files.*']);

        return new LengthAwarePaginator(
            $results,
            $count->select('files.id')->get()->count(),
            $builder->getPageSize(),
            $builder->getPage()
        );
    }
229811
public function withPaginator(LengthAwarePaginator $paginator, $transformer, $resourceKey = null, $meta = [])
    {
        $queryParams = array_diff_key($_GET, array_flip(['page']));
        $paginator->appends($queryParams);
        
        $resource = new Collection($paginator->items(), $transformer, $resourceKey);
        $resource->setPaginator(new IlluminatePaginatorAdapter($paginator));

        foreach ($meta as $metaKey => $metaValue) {
            $resource->setMetaValue($metaKey, $metaValue);
        }

        $rootScope = $this->manager->createData($resource);

        return $this->withArray($rootScope->toArray());
    }
862916
public function search(QueryBuilderInterface $Builder) {
        $this->serialyse($Builder);
        $statement = $this->connector->query($this->parsedQuery);
        $result    = $this->statementToArray($statement);
        $resultSetClass = $this->resultSetClassName;
        $resultSet = new $resultSetClass($result);
        $queryCount = $this->getSerialyser()->setCriteriaList($Builder)->count(true)->serialyse();
        $resultSet->setParent($this)->setCountQuery($queryCount);
        return $resultSet;
    }
380642
public function mapContent(Content $content)
    {
        return new FullTextData(
            [
                'id' => $content->versionInfo->contentInfo->id,
                'contentTypeId' => $content->versionInfo->contentInfo->contentTypeId,
                'sectionId' => $content->versionInfo->contentInfo->sectionId,
                'published' => $content->versionInfo->contentInfo->publicationDate,
                'values' => $this->getFullTextValues($content),
            ]
        );
    }