0 follower

Final Class Yiisoft\Db\Pgsql\Quoter

InheritanceYiisoft\Db\Pgsql\Quoter » Yiisoft\Db\Schema\Quoter

Public Methods

Hide inherited methods

Method Description Defined By
quoteColumnName() Yiisoft\Db\Pgsql\Quoter

Method Details

Hide inherited methods

quoteColumnName() public method

public quoteColumnName( string $name ): string
$name string

                public function quoteColumnName(string $name): string
{
    if (str_contains($name, '(') || str_contains($name, '[[')) {
        return $name;
    }
    $dotPos = strrpos($name, '.');
    if ($dotPos !== false) {
        $prefix = $this->quoteTableName(substr($name, 0, $dotPos)) . '.';
        $name = substr($name, $dotPos + 1);
    } else {
        $prefix = '';
    }
    if (str_contains($name, '{{')) {
        return $name;
    }
    $bracketPos = strpos($name, '[');
    if ($bracketPos !== false) {
        $suffix = substr($name, $bracketPos);
        $name = substr($name, 0, $bracketPos);
    } else {
        $suffix = '';
    }
    return $prefix . $this->quoteSimpleColumnName($name) . $suffix;
}