protected static function getConnection(string $connection = 'Default'): array {
    $configuration = [];

    if (is_array($GLOBALS['TYPO3_CONF_VARS']['DB']['Connections'][$connection])) {
      $extensionConfiguration = $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['t3v_datamapper'];

      if (is_string($extensionConfiguration)) {
        $extensionConfiguration = @unserialize($extensionConfiguration);
      }

      $configuration = [
        'driver'    => $extensionConfiguration['driver'] ?: 'mysql',
        'host'      => $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections'][$connection]['host'],
        'username'  => $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections'][$connection]['user'],
        'password'  => $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections'][$connection]['password'],
        'database'  => $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections'][$connection]['dbname'],
        'charset'   => $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections'][$connection]['charset'] ?: 'utf8',
        'collation' => $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections'][$connection]['collation'] ?: 'utf8_general_ci',
        'prefix'    => $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections'][$connection]['prefix'] ?: ''
      ];
    }

    return $configuration;
  }
protected static function getConnection(string $connection = 'Default'): array {
    $configuration = [];

    if (is_array($GLOBALS['TYPO3_CONF_VARS']['DB']['Connections'][$connection])) {
      $extensionConfiguration = $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['t3v_datamapper'];

      if (is_string($extensionConfiguration)) {
        $extensionConfiguration = @unserialize($extensionConfiguration);
      }

      $configuration = [
        'driver'    => $extensionConfiguration['driver'] ?: 'mysql',
        'host'      => $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections'][$connection]['host'],
        'username'  => $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections'][$connection]['user'],
        'password'  => $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections'][$connection]['password'],
        'database'  => $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections'][$connection]['dbname'],
        'charset'   => $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections'][$connection]['charset'] ?: 'utf8',
        'collation' => $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections'][$connection]['collation'] ?: 'utf8_general_ci',
        'prefix'    => $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections'][$connection]['prefix'] ?: ''
      ];
    }

    return $configuration;
  }
protected static function getConnection ( string $ connection = 'Default' ) : array { $ configuration = [ ] ; if ( is_array ( $ GLOBALS [ 'TYPO3_CONF_VARS' ] [ 'DB' ] [ 'Connections' ] [ $ connection ] ) ) { $ extensionConfiguration = $ GLOBALS [ 'TYPO3_CONF_VARS' ] [ 'EXT' ] [ 'extConf' ] [ 't3v_datamapper' ] ; if ( is_string ( $ extensionConfiguration ) ) { $ extensionConfiguration = @ unserialize ( $ extensionConfiguration ) ; } $ configuration = [ 'driver' => $ extensionConfiguration [ 'driver' ] ? : 'mysql' , 'host' => $ GLOBALS [ 'TYPO3_CONF_VARS' ] [ 'DB' ] [ 'Connections' ] [ $ connection ] [ 'host' ] , 'username' => $ GLOBALS [ 'TYPO3_CONF_VARS' ] [ 'DB' ] [ 'Connections' ] [ $ connection ] [ 'user' ] , 'password' => $ GLOBALS [ 'TYPO3_CONF_VARS' ] [ 'DB' ] [ 'Connections' ] [ $ connection ] [ 'password' ] , 'database' => $ GLOBALS [ 'TYPO3_CONF_VARS' ] [ 'DB' ] [ 'Connections' ] [ $ connection ] [ 'dbname' ] , 'charset' => $ GLOBALS [ 'TYPO3_CONF_VARS' ] [ 'DB' ] [ 'Connections' ] [ $ connection ] [ 'charset' ] ? : 'utf8' , 'collation' => $ GLOBALS [ 'TYPO3_CONF_VARS' ] [ 'DB' ] [ 'Connections' ] [ $ connection ] [ 'collation' ] ? : 'utf8_general_ci' , 'prefix' => $ GLOBALS [ 'TYPO3_CONF_VARS' ] [ 'DB' ] [ 'Connections' ] [ $ connection ] [ 'prefix' ] ? : '' ] ; } return $ configuration ; }
Returns the connection configuration from the Global TYPO3 configuration options.

@param string $connection The optional connection, defaults to `Default`
@return array The connection configuration
@link https://laravel.com/docs/master/database#configuration The Laravel Database Configuration
@link https://docs.typo3.org/typo3cms/CoreApiReference/stable/ApiOverview/GlobalValues/GlobalVariables The TYPO3 Global variables
Returns the connection configuration from the Global TYPO3 configuration options .