Doctrine\DBAL\Connection::getUsername PHP Method

getUsername() public method

Gets the username used by this connection.
public getUsername ( ) : string | null
return string | null
    public function getUsername()
    {
        return isset($this->_params['user']) ? $this->_params['user'] : null;
    }

Usage Example

コード例 #1
0
 public function getDsn()
 {
     $driver = $this->connection->getDriver()->getName();
     $user = $this->connection->getUsername();
     $pass = $this->connection->getPassword();
     $host = $this->connection->getHost();
     $db = $this->connection->getDatabase();
     return "{$driver}://{$user}:{$pass}@{$host}/{$db}";
 }
All Usage Examples Of Doctrine\DBAL\Connection::getUsername