Quotes table or field name with alias.
Example: "select from users as u" will become "select from `users` as `u`"

@param string $name
@return string
16364
private function quoteAliasedName(string $name): string
    {
        $parts = preg_split('/ AS /i', $name);
        foreach ($parts as $i => $part) {
            $parts[$i] = $this->quoteSimpleName($part);
        }
        return implode(' AS ', $parts);
    }
718918
public function getAlias(string $aliasName)
    {
        $aliasName = strtolower($aliasName);
        return isset($this->_alias[$aliasName]) ? $this->_alias[$aliasName] : '';
    }
297791
public function encode($name) {
		$aliases = $this->aliases;
		if(empty($aliases)) {
			return $name;
		}
		return $this->aggregate($name, $aliases);
	}
570603
protected function getFieldValue($name)
    {
        $field = $this->getField($name);

        if ($field->getSqlType()) {
            $platform = $this->getConnection()->getDatabasePlatform();

            $attributeValue = $this->getAttribute($field->getAttributeName());

            if ($name == $field->getAttributeName()) {
                return $field->convertToPHPValueSQL($attributeValue, $platform);
            }

            return $field->convertToPHPValue($attributeValue, $platform);
        }

        return $field->getValue();
    }
504848
public function select($fields = '*')
    {
        if (is_string($fields) && strpos($fields, '(') !== false) {
            $this->query['select'] = $fields;
        } else {
            if (!is_array($fields)) {
                $fields = $this->splitParts($fields);
            }
            foreach ($fields as $k => $field) {
                if (false === strpos($field, '(')) {
                    if ($alias = $this->matchAlias($field)) {
                        $fields[$k] = $this->db->quoteColumn($alias[0]) . ' AS ' . $this->db->quoteColumn($alias[1]);
                    } else {
                        $fields[$k] = $this->db->quoteColumn($field);
                    }
                }
            }
            $this->query['select'] = implode(', ', $fields);
        }

        return $this;
    }
997529
def quote_name(self, name):
        
        if name.startswith(self.left_sql_quote) and name.endswith(self.right_sql_quote):
            return name # Quoting once is enough.
        return '%s%s%s' % (self.left_sql_quote, name, self.right_sql_quote)
66726
public function getFieldWithTableAlias($name, $table_alias = null)
    {
        $replace = $table_alias === null ? '' : sprintf("%s.", $table_alias);

        return $this->replaceToken($this->checkFieldExist($name)->fields[$name], $replace);
    }
749691
public function alias(string $alias = null)
    {
        $clone = clone $this;
        $clone->value = sprintf('%s AS %s', $clone->value, $this->quoter->quoteName($alias));

        return $clone;
    }
816172
protected function subselect_query($name)
    {
        if (isset($this->subselect_query[$name]))
        {
            $sql = $this->subselect_query[$name];
        }
        else
        {
            $sql = preg_replace_callback('/\{(.+)\}/Uu', array($this, 'subselect_callback'), $this->subselect[$name]);
            $this->subselect_query[$name] = $sql;
        }
        return "({$sql}) AS `{$name}`";
    }
1118315
public function getAlias($name)
    {
        $aliases = $this->getAliases();
        if (isset($aliases[$name])) {
            return $aliases[$name];
        }
        return null;
    }
156160
protected function quoteNameString($name, $asSinglePart = false)
	{
		$q = $this->nameQuote . $this->nameQuote;

		// Double quote reserved keyword
		$name = str_replace($q[1], $q[1] . $q[1], $name);

		if ($asSinglePart)
		{
			return $q[0] . $name . $q[1];
		}

		return $q[0] . str_replace('.', "$q[1].$q[0]", $name) . $q[1];
	}
439507
public function quoteIdentifier($string, $tableName = '')
    {
        if ($this->isIdentifierQuotingEnabled()) {
            $adapter = Propel::getServiceContainer()->getAdapter($this->getDbName());

            return $adapter->quote($string);
        }

        //find table name and ask tableMap if quoting is enabled
        if (!$tableName && false !== ($pos = strrpos($string, '.'))) {
            $tableName = substr($string, 0, $pos);
        }

        $tableMapName = $this->getTableForAlias($tableName) ?: $tableName;

        if ($tableMapName) {
            $dbMap = Propel::getServiceContainer()->getDatabaseMap($this->getDbName());
            if ($dbMap->hasTable($tableMapName)) {
                $tableMap = $dbMap->getTable($tableMapName);
                if ($tableMap->isIdentifierQuotingEnabled()) {
                    $adapter = Propel::getServiceContainer()->getAdapter($this->getDbName());

                    return $adapter->quote($string);
                }
            }
        }

        return $string;
    }
129991
public static function table($name)
    {
        Helpers\Validate::table($name)->exists();

        $self       = new self();
        $self->name = $name;

        $self->setFields();
        $self->setPending();

        return $self;
    }
1155589
private function parseReferences($name): string
    {
        if (preg_match_all('/\$\{(.*[a-z\.0-9])\}/si', $name, $results, PREG_SET_ORDER)) {
            foreach ($results as $match) {
                $replace = $match[0];
                $key = $match[1];

                // Handle using relative placement like get('db.${.default}.host');
                if (strpos($key, '.') === 0) {
                    // using relative placement
                    $key = substr($name, 0, strpos($name, $replace) - 1) . $key;
                }

                // get the value
                $value = $this->get($key);
                if ($value === null || $value === '' || $value === false) {
                    throw new InvalidArgumentException(
                        $key . ' replacement for ' . $name . ' must not be null or empty'
                    );
                }

                $name = str_replace($replace, $value, $name);
            }
        }

        return $name;
    }
1220418
public function name($name, $aliases = [])
    {
        if (!is_string($name)) {
            return $this->names($name, $aliases);
        }
        list($alias, $field) = $this->undot($name);
        if (isset($aliases[$alias])) {
            $alias = $aliases[$alias];
        }
        return $alias ? $this->escape($alias) . '.' . $this->escape($field) : $this->escape($name);
    }
301365
public function getSelectName() : ?string
    {
        if (null !== $this->select_name) {
            return $this->select_name . ' as ' . $this->getDBName();
        }
        if (null !== $this->db_name) {
            return $this->db_name;
        }
        return $this->attributes['name'];
    }
1277005
public function getAlias($name)
        {
            if (isset($this->_aliases[$name])) {
                return $this->_aliases[$name];
            }

            return null;
        }