Get the QueryBuilder instance.

@param  string $repositoryMethod

@return QueryBuilder
969997
protected function getQueryBuilder($repositoryMethod)
    {
        $repository = $this
            ->getDriver()
            ->getDoctrineOrmEm()
            ->getRepository($this->getDriver()->getEntityFqn())
        ;

        $repositoryMethods = $this->getDriver()->getEntityRepositorySearchableMethods();

        if (!method_exists($repository, $repositoryMethods[$repositoryMethod])) {
            return $repository->createQueryBuilder($this->getDriver()->getEntityAlias());
        }

        $queryBuilder = $repository->{$repositoryMethods[$repositoryMethod]}();

        if (!$queryBuilder instanceof QueryBuilder) {
            throw new ResourceException(sprintf(
                'The method "%s" of repository class must be return a %s instance',
                $repositoryMethods[$repositoryMethod],
                '\Doctrine\ORM\QueryBuilder'
            ));
        }

        return $queryBuilder;
    }
124730
public function build(Repository $query)
    {
        if (! $this->display) {
            return;
        }

        if (! is_null($this->view)) {
            return view($this->view, $query->all());
        }

        return view('platform::container.layouts.link', [
            'name'      => $this->name,
            'method'    => $this->method,
            'icon'      => $this->icon,
            'modal'     => $this->modal,
            'title'     => $this->title,
            'link'      => $this->link,
            'group'     => $this->group,
            'confirm'   => $this->confirm,
            'query'     => $query,
        ]);
    }
1015315
public static function query(string $driver, RepositoryDriver $repositoryDriver): QueryRelateContract
    {
        switch ($driver) {
            case 'eloquent':
                return new QueryRelate($repositoryDriver);
            default:
                throw new InvalidArgumentException("Driver [{$driver}] not found");
        }
    }
1088147
public function getStubQueryBuilder()
    {
        if (!isset($this->stubQueryBuilder)) {
            $this->stubQueryBuilder = $this->getGeneratorConfig()->getConfiguredBuilder($this->getTable(), 'querystub');
        }

        return $this->stubQueryBuilder;
    }
159675
protected function getPaginator4QueryBuilder($queryBuilder, $page = 1)
    {
        if (!$queryBuilder) {
            return null;
        }

        $adapter = new DoctrineAdapter(new ORMPaginator($queryBuilder));
        $paginator = new Paginator($adapter);
        $paginator->setDefaultItemCountPerPage($this->defaultItemCountPerPage);
        $paginator->setCurrentPageNumber($page);

        return $paginator;
    }
560459
public function getRepository(EntityManagerInterface $entityManager, $className) {
		if(!isset($this->repositories[$className])) {
			$this->repositories[$className] = $this->generateRepository($entityManager, $className);
		}
		return $this->repositories[$className];
	}
80552
public function getQuery(QueryBuilder $queryBuilder)
    {
        $rule = $this->getRule();
        $activeFrom = $rule->getActiveFrom();
        $activeUntil = $rule->getActiveUntil();

        $resultQueryBuilder = $queryBuilder;

        if (!is_null($activeFrom)) {
            $resultQueryBuilder = $resultQueryBuilder
                ->andWhere('l.dateLog >= :activeFrom')
                ->setParameter(
                    'activeFrom',
                    $activeFrom->format('Y-m-d H:i:s')
                );
        }
        if (!is_null($activeUntil)) {
            $resultQueryBuilder = $resultQueryBuilder
                ->andWhere('l.dateLog <= :activeUntil')
                ->setParameter(
                    'activeUntil',
                    $activeUntil->format('Y-m-d H:i:s')
                );
        }

        return $resultQueryBuilder;
    }
778780
public function getOne($repository, $id)
    {
        $repoConfig = $this->repos[$repository];
        /** @var $q \Doctrine\ORM\QueryBuilder */
        return $this->doctrine
            ->getRepository($repoConfig['repository'])
            ->find($id);
    }
333176
public function cloneQueryBuilder()
    {
        $paramContent = $this->newParamName();
        
        $subQuery = clone $this->queryBuilder;
        $subQuery->resetDQLParts();
        $subQuery->setParameters([]);
        $subQuery->select($paramContent)->from('OpiferCmsBundle:Content', $paramContent);

        return $subQuery;
    }
475728
private static function _getRepositoryManager()
	{
		self::_init();
		if (!self::$repositoryManager)
		{
			self::$repositoryManager = self::$composer->getRepositoryManager();
		}
		return self::$repositoryManager;
	}
555942
public function createQueryBuilder($alias, $indexBy = null)
    {
        $qb = $this->repository->createQueryBuilder($alias, $indexBy);

        $this->applySecurityModel($qb, $alias);

        return $qb;
    }
1362088
public static function createQueryBuilder() {
		if(self::$entity_manager == null)
			self::initialize();

		return call_user_func_array(array(self::$entity_manager, "createQueryBuilder"), func_get_args());
	}
394678
public function findByMethod($method, array $columns = ['*'])
    {
        $this->applyCriteria();

        $result = $this->model->{$method}($columns);

        if ( ! $result )
            throw new RepositoryException("Method {{$method}} does not exist on the model.");

        return $result;
    }
462797
public function buildQueryBuilder()
    {
        $builder = new QueryBuilder();

        foreach ($this->parsers as $parser) {
            if ($parser->wasApplied()) {
                $parser->apply($builder);
            }
        }

        foreach ($this->sorts as $sort) {
            $builder->orderBy($sort[0], $sort[1]);
        }

        if (!empty($this->perPage)) {
            $builder->setPageSize($this->perPage);
        }

        if (!empty($this->page)) {
            $builder->setPage($this->page);
        }

        if (!empty($this->searchQuery)) {
            $builder->setSearchQuery($this->searchQuery);
        }

        return $builder;
    }
135020
public function getQueryBuilder($type='default') {
		return isset($this->queryBuilders[$type]) ? Injector::inst()->create($this->queryBuilders[$type]) : Injector::inst()->create($this->queryBuilders['default']);
	}
849197
protected function newBaseQueryBuilder()
    {
        $connection = $this->getConnection();

        return new QueryBuilder($connection, $connection->getQueryGrammar(), $connection->getPostProcessor());
    }
570548
public function getRepository($class)
    {
        $classMetadata = $this->getClassMetadataFor($class);
        if (!array_key_exists($class, $this->repositories)) {
            $repositoryClassName = $classMetadata->hasCustomRepository() ? $classMetadata->getRepositoryClass() : BaseRepository::class;
            $this->repositories[$class] = new $repositoryClassName($classMetadata, $this, $class);
        }

        return $this->repositories[$class];
    }