@param Expression $expression
@param null       $alias

@return Expression
182901
public function completeExpression(Expression $expression, $alias = null)
    {
        return $this->getBuilder()->completeExpression($expression, $alias);
    }
503319
public function get($alias) {
        return !empty($this->routingTable[$alias]) ? $this->routingTable[$alias] : null;
    }
550556
public function buildExpression(Expression $expr = null)
    {
        if (!$this->defaultExpression) {
            $this->defaultExpression = Expr::same(BindingState::ENABLED, BindingDescriptor::STATE)
                ->andSame(AssetPlugin::BINDING_TYPE, BindingDescriptor::TYPE_NAME)
                ->andEndsWith('{,/**/*}', BindingDescriptor::QUERY);
        }

        if (!$expr) {
            return $this->defaultExpression;
        }

        $traverser = new ExpressionTraverser();
        $traverser->addVisitor($this);

        return $this->defaultExpression->andX($traverser->traverse($expr));
    }
716452
public function setAlias($alias = null)
    {
        if (!empty($alias)) {
            $this->query['alias'] = $alias;
        } else {
            unset($this->query['alias']);
        }
        return $this;
    }
236320
public function findByAlias(string $alias): ?Tag
    {
        /** @var TagModel $adapter */
        $adapter = $this->framework->getAdapter(TagModel::class);

        $criteria = $this->getCriteria();
        $criteria['alias'] = $alias;

        if (null === ($model = $adapter->findOneByCriteria($criteria))) {
            return null;
        }

        return ModelCollection::createTagFromModel($model);
    }
286803
protected function _renderExpression(TermInterface $expression, $context = null)
    {
        if ($expression instanceof ExpressionInterface) {
            return $this->_renderExpressionAndTerms($expression, $context);
        }

        return $this->_renderExpressionTerm($expression, $context);
    }
823454
public static function query($alias = null, $model = null)
    {
        if (!$model) {
            $model = Di::getDefault()->getShared(static::class);
        }

        return $model->_di->get('ManaPHP\Mongodb\Query')->setModel($model)->setTypes($model->getFieldTypes());
    }
95086
public function from($table, $alias = null)
    {
        $this->from['table'] = $table;
        $this->from['alias'] = $alias;

        return $this;
    }
1042136
public function from($table, $alias = null) {
        $this->from [] = self::parseAs($table, $alias);

        return $this;
    }
310898
public function alias($identifier, $alias)
    {
        $alias      = trim((string) $alias);
        $identifier = (string) $identifier;

        //Don't register the alias if it's the same as the identifier
        if($alias != $identifier) {
            $this->_aliases[$alias] = (string) $identifier;
        }

        return $this;
    }
592493
public function select($expression = '*')
    {
        if (!is_array($expression)) {
            $expression = explode(',', $expression);
        }

        $this->type        = self::TYPE_SELECT;
        $this->expressions = array_merge($this->expressions, array_map(function ($expression, $alias) {
            return is_string($alias) ? "$expression AS $alias" : $expression;
        }, $expression, array_keys($expression)));

        return $this;
    }
1279872
public function select($column, $alias = null)
    {
        $this->select[$this->columnQuote($column)] = $this->columnQuote($alias);
        
        return $this;
    }
648529
public function table($table, $alias = null)
    {
        if ($alias) {
            $table = [$alias => $table];
        } elseif (!is_array($table)) {
            $table = [$table];
        }

        $this->joins = [];
        foreach ($table as $alias => $name) {
            if ($name instanceof QueryInterface) {
                $expression = '(' . $name->getQuery() . ')';
            } else {
                $expression = $this->connection->quoteIdentifier($name);
            }
            if (is_string($alias)) {
                $this->tables[$alias] = $expression . ' ' . $alias;
            } else {
                $this->tables[$name] = $expression;
            }
        }

        return $this;
    }
859707
public function create(ExpressionInterface $expression = null)
	{
		if($expression instanceof ConditionInterface)
		{
			return new ConditionBuilder($expression);
		}
		elseif($expression instanceof JoinInterface)
		{
			return new JoinBuilder($expression);
		}
		else
		{
			return new NullBuilder();
		}
	}
247736
public With andWith(final String alias, final Expression expression) {
        this.clauses.add(new ImmutablePair<>(new Name(alias), expression));
        return this;
    }
110423
public static <D> SimpleExpression<D> as(Expression<D> source, String alias) {
        return as(source, ExpressionUtils.path(source.getType(), alias));
    }
585831
public function ucase($column, string $alias = null): self
    {
        return $this->column((new Expression())->ucase($column), $alias);
    }