Register a table used in the query
@param string $name The name of the table
@param string $alias The alias for the table
@return $this Provides fluent interface
6972
public function registerTable($name, $alias)
    {
        if (!empty($alias) && empty($name))
            return;

        if (!empty($alias) && !empty($this->parent_scope))
        {
            $table = $this->parent_scope->resolveAlias($alias); 
            if (!empty($table))
                throw new QueryException("Duplicate alias \"$alias\" - was already bound to \"$table\" in parent scope");
        }

        if (isset($this->tables[$name]))
        {
            if (empty($alias))
                throw new QueryException("Duplicate table without an alias: \"$name\"");
            if (isset($this->tables[$name][$alias]))
                throw new QueryException("Duplicate alias \"$alias\" for table \"$name\"");
            if (isset($this->tables[$name][$name]))
                throw new QueryException("All instances of a table reference must be aliased if used more than once");

            $this->tables[$name][$alias] = true;
            $this->aliases[$alias] = $name;
        }
        elseif (!empty($alias) && is_string($alias))
        {
            if (isset($this->aliases[$alias]))
                throw new QueryException("Duplicate alias \"$alias\" for table \"$name\" - also referring to \"{$this->aliases[$alias]}\"");
            $this->aliases[$alias] = $name;
            $this->tables[$name][$alias] = true;
        }
        else
        {
            $this->tables[$name][$name] = true;
        }
        return $this;
    }
357808
public function from(string $table, string $alias = null, $field = null): Select
    {
        $this->from[] = [
          'table' => $table,
          'alias' => $alias
        ];

        if ($field !== null) {
            if (is_array($field)) {
                foreach ($field as $fld) {
                    $this->field(($alias ?? $table) . '.' . $fld);
                }
            } else {
                $this->field(($alias ?? $table) . '.' . $field);
            }
        }

        return $this;
    }
452901
public function addFrom(?string $tableKey, $table, ?string $alias, array $params = [])
    {
        $this->from[$tableKey] = [
            'tableKey' => $tableKey,
            'table'    => $table,
            'alias'    => $alias,
            'params'   => $params,
        ];

        return $this;
    }
322761
public function addTable($alias, $table, $condition = null, $joinType = 'LEFT', $prefix = null)
    {
        $tableStorage = [];

        $tableStorage['name'] = $table;
        $tableStorage['join'] = strtoupper($joinType);

        $condition = trim((string) new QueryElement('', (array) $condition, ' AND '));

        if (!$condition) {
            $tableStorage['join'] = 'FROM';
        }

        // Remove too many spaces
        $condition = preg_replace('/\s(?=\s)/', '', $condition);

        $tableStorage['condition'] = $condition;
        $tableStorage['prefix'] = $prefix;

        $this->tables[$alias] = $tableStorage;

        return $this;
    }
562734
public function setAlias($alias)
    {
        /**
         * @T00D00
         */
        $this->alias = $alias;
        $this->getQuery()->alias($alias);

        return $this;
    }
354878
public function alias($alias, $key)
    {
        if ($key !== $alias && $this->has($key)) {
            $this->_aliases[$alias] = $key;
        }
        
        return $this;
    }
826221
public function from($tables, $alias=null) {
		$this->tables = [];
		if(is_string($tables))
			return $this->addFrom($tables);
		else
			return $this->addFrom([$alias => $tables]);
	}
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;
    }
1224278
public function join($tableName, $alias = null)
    {
        $this->joins[] = ' LEFT JOIN ?f as ?f';
        $this->lastJoinAlias = $alias;
        $this->joinArguments[] = $tableName;
        $this->joinArguments[] = $alias;
        return $this;
    }
1100593
public static function table($name)
    {
        Validate::table($name)->exists();

        $self                  = new self();
        $self->tables['local'] = $name;

        return $self;
    }
244226
public function addAliases($alias)
    {
        foreach (func_get_args() as $alias) {
            $this->aliases[$alias] = true;
        }
        return $this;
    }
203634
public function removeTable($alias)
    {
        if (!empty($this->tables[$alias])) {
            unset($this->tables[$alias]);
        }

        return $this;
    }
826249
public function alias($alias, $name) {
		if (is_array($alias)) {
			foreach ($alias as $key) {
				$this->alias($key, $name);
			}

			return;
		}

		$this->aliases[$alias] = $name;
	}
1284098
public function registerClass($alias, $class)
    {
        $classSymbol = new ClassSymbol($alias, $class);
        $this->classes[$alias] = $classSymbol;
        $aliasNamespace = $classSymbol->getAliasNamespace();
        if (!in_array($aliasNamespace, $this->aliasNamespaces, true)) {
            $this->aliasNamespaces[] = $aliasNamespace;
        }
    }
1134428
public function table(string $table, string $alias = null, string $database = null)
    {
        $this->option->table->useRaw(false);
        $this->option->table->setTable($table);
        $this->option->table->setAlias($alias);
        $this->option->table->setDatabase($database);
        return $this;
    }
924161
public final function alias($alias) {
        $this->alias         = $alias;
        $this->qualifiedName = $this->table . ' AS ' . $this->alias;

        return $this;
    }
565356
public function aliasHelper(string $alias)
    {
        if (!($this instanceof AliasInterface)) {
            throw RegisterException::noAlias();
        }
        if (!$alias) {
            throw RegisterException::blank();
        }
        if ($this instanceof ContainerAwareInterface && $this->isBound()) {
            if (!$this->getManager()->isRegistered($alias)) {
                $this->getManager()->register($this, $alias);
            }
        }
    }