Creates a new QueryBuilder instance that is prepopulated for this entity name.

@param string $alias

@return QueryBuilder
195459
public function createQueryBuilder($alias = null)
    {
        if ($alias === null) {
            $alias = $this->getAlias();
        }

        if (empty($alias)) {
            $select = '*';
        } else {
            $select = $alias . '.*';
        }

        return $this->em->createQueryBuilder()
            ->select($select)
            ->from($this->getTableName(), $alias);
    }
376366
public function required(string $alias, string $type): EntityDefinitionOptions {
    return $this->required[$alias] = new EntityDefinitionOptions($alias, $type);
  }
1319295
protected function newBaseQueryBuilder()
    {
        $conn = $this->getConnection();

        $grammar = $conn->getQueryGrammar;

        return new QueryBuilder($conn, $grammar);
    }
262372
public function getQueryBuilder(): QueryBuilder
    {
        if (!$this->queryBuilder) {
            $this->queryBuilder = $this->repository->createQueryBuilder($this->getAlias());
            if ($this->getConfiguration()->getOption('enforce_family_condition', true)) {
                $familyParam = uniqid('family', false);
                $this->queryBuilder
                    ->andWhere("{$this->getAlias()}.family = :{$familyParam}")
                    ->setParameter($familyParam, $this->getFamily()->getCode());
            }
        }

        return $this->queryBuilder;
    }
84120
public function column($name, $alias = null)
    {
        if ($alias === null) {
            $this->columns[] = $this->grammar->buildId($name);
        } else {
            $this->columns[] = $this->grammar->buildIdWithAlias($name, $alias);
        }

        return $this;
    }
1165167
public function selectColumn(string $column, ?string $alias = null)
    {
        $instance = $this->selectQueryInstance();

        $instance->selectQuery()->column($column, $alias);

        return $instance;
    }
74780
public function max($column, $alias = null)
    {
        $this->queryBuilder->max($column, $alias);
        return $this;
    }
776570
protected function addEnabledFilter(QueryBuilder $qb, $alias = 'translations')
    {
        $qb->andWhere($alias.'.enabled = :enabled')->setParameter('enabled', true);

        return $this;
    }
391085
public function selectSelect(SelectQuery $column, ?string $alias = null)
    {
        $instance = $this->selectQueryInstance();

        $instance->selectQuery()->columnSelect($column, $alias);

        return $instance;
    }
210992
public static function table($alias = null)
    {
        $className = get_called_class();
        $tableKey = $className . ($alias ? ':' . $alias : '');
        $table = &self::$tables[$tableKey];
        if (null !== $table) {
            return $table;
        }
        /*
        if (isset(self::$settingColumns[$tableKey])) {
            throw new Exception('Already setting columns');
        }
        $columns = new \stdClass();
        self::$settingColumns[$tableKey] = $columns;
        unset(self::$settingColumns[$tableKey]);
        */
        $schemaName = Utils::fromCamelCase(str_replace('\\', '', $className));
        $table = new Table(null, self::getDatabase($className), $schemaName);
        $table->entityClassName = $className;
        $table->alias = $alias;
        static::setUpColumns($table->columns);
        static::setUpTable($table, $table->columns);

        return $table;
    }
1351111
public function getInstance($alias = null)
    {
        if (!$alias && !$this->mainAlias) {
            $namespace = explode('\\', $this->_entityName);
            $alias = strtolower(end($namespace));
            $this->mainAlias = $alias;
        } elseif ($alias) {
            $this->mainAlias = $alias;
        }

        return $this->qb ? $this->qb : $this->qb = $this->createQueryBuilder($this->mainAlias);
    }
80211
public function getQueryBuilder($specification, $alias = null)
    {
        $qb = $this->createQueryBuilder($alias ?: $this->getAlias());
        $this->applySpecification($qb, $specification, $alias);

        return $qb;
    }
559534
public static function createQueryBuilder($queryBuilder)
    {
        if ($queryBuilder instanceof ORMBuilder) {
            return new ORMQueryBuilder($queryBuilder);
        }
        if ($queryBuilder instanceof DBALBuilder) {
            return new DBALQueryBuilder($queryBuilder);
        }

        throw new QueryBuilderException(
            sprintf('Invalid parameter "queryBuilder". Use %s or %s', ORMBuilder::class, DBALBuilder::class)
        );
    }
1208418
public function optional(string $alias, string $type): EntityDefinitionOptions {
    return $this->optional[$alias] = new EntityDefinitionOptions($alias, $type);
  }
1149559
public static function create($modelAlias = null, $criteria = null)
    {
        if ($criteria instanceof UserQuery) {
            return $criteria;
        }
        $query = new UserQuery(null, null, $modelAlias);

        if ($criteria instanceof Criteria) {
            $query->mergeWith($criteria);
        }

        return $query;
    }
445919
public static function create($modelAlias = null, $criteria = null)
    {
        if ($criteria instanceof \CustomerGroup\Model\CustomerCustomerGroupQuery) {
            return $criteria;
        }
        $query = new \CustomerGroup\Model\CustomerCustomerGroupQuery();
        if (null !== $modelAlias) {
            $query->setModelAlias($modelAlias);
        }
        if ($criteria instanceof Criteria) {
            $query->mergeWith($criteria);
        }

        return $query;
    }
209762
public function newQuery() : QueryBuilder
    {
        $model = $this->container->make($this->getModelName());

        if (!$model instanceof Model) {
            throw new RepositoryException("Class {$this->model()} must be an instance of " . Model::class);
        }

        return $model->newQuery();
    }