src/mako/database/ConnectionManager.php
protected function connect(string $connectionName): Connection
	{
		if(!isset($this->configurations[$connectionName]))
		{
			throw new RuntimeException(vsprintf('[ %s ] has not been defined in the database configuration.', [$connectionName]));
		}

		$config = $this->configurations[$connectionName];

		$driver = $this->normalizeDriverName(explode(':', $config['dsn'], 2)[0]);

		$compiler = $this->getQueryCompilerClass($driver);

		$helper = $this->getQueryBuilderHelperClass($driver);

		$connection = $this->getConnectionClass($driver);

		return new $connection($connectionName, $compiler, $helper, $config);
	}
protected function connect(string $connectionName): Connection
	{
		if(!isset($this->configurations[$connectionName]))
		{
			throw new RuntimeException(vsprintf('[ %s ] has not been defined in the database configuration.', [$connectionName]));
		}

		$config = $this->configurations[$connectionName];

		$driver = $this->normalizeDriverName(explode(':', $config['dsn'], 2)[0]);

		$compiler = $this->getQueryCompilerClass($driver);

		$helper = $this->getQueryBuilderHelperClass($driver);

		$connection = $this->getConnectionClass($driver);

		return new $connection($connectionName, $compiler, $helper, $config);
	}
protected function connect ( string $ connectionName ) : Connection { if ( ! isset ( $ this -> configurations [ $ connectionName ] ) ) { throw new RuntimeException ( vsprintf ( '[ %s ] has not been defined in the database configuration.' , [ $ connectionName ] ) ) ; } $ config = $ this -> configurations [ $ connectionName ] ; $ driver = $ this -> normalizeDriverName ( explode ( ':' , $ config [ 'dsn' ] , 2 ) [ 0 ] ) ; $ compiler = $ this -> getQueryCompilerClass ( $ driver ) ; $ helper = $ this -> getQueryBuilderHelperClass ( $ driver ) ; $ connection = $ this -> getConnectionClass ( $ driver ) ; return new $ connection ( $ connectionName , $ compiler , $ helper , $ config ) ; }
Connects to the chosen database and returns the connection.

@param  string                                $connectionName Connection name
@throws \RuntimeException
@return \mako\database\connections\Connection
Connects to the chosen database and returns the connection .