protected function getMagentoDbConnection($dir, $connectionName = 'default')
    {

        // load the magento environment
        $env = require $this->getMagentoEnv($dir);

        // query whether or not, the requested connection is available
        if (isset($env[MagentoConfigurationKeys::DB][MagentoConfigurationKeys::CONNECTION][$connectionName])) {
            // load the connection data
            $connection = $env[MagentoConfigurationKeys::DB][MagentoConfigurationKeys::CONNECTION][$connectionName];

            // create and return a new database configuration
            return $this->newDatabaseConfiguration(
                $this->newDsn($connection[MagentoConfigurationKeys::HOST], $connection[MagentoConfigurationKeys::DBNAME]),
                $connection[MagentoConfigurationKeys::USERNAME],
                $connection[MagentoConfigurationKeys::PASSWORD],
                false
            );
        }

        // throw an execption if not
        throw new \Exception(sprintf('Requested Magento DB connection "%s" not found in Magento "%s"', $connectionName, $dir));
    }
protected function getMagentoDbConnection($dir, $connectionName = 'default')
    {

        // load the magento environment
        $env = require $this->getMagentoEnv($dir);

        // query whether or not, the requested connection is available
        if (isset($env[MagentoConfigurationKeys::DB][MagentoConfigurationKeys::CONNECTION][$connectionName])) {
            // load the connection data
            $connection = $env[MagentoConfigurationKeys::DB][MagentoConfigurationKeys::CONNECTION][$connectionName];

            // create and return a new database configuration
            return $this->newDatabaseConfiguration(
                $this->newDsn($connection[MagentoConfigurationKeys::HOST], $connection[MagentoConfigurationKeys::DBNAME]),
                $connection[MagentoConfigurationKeys::USERNAME],
                $connection[MagentoConfigurationKeys::PASSWORD],
                false
            );
        }

        // throw an execption if not
        throw new \Exception(sprintf('Requested Magento DB connection "%s" not found in Magento "%s"', $connectionName, $dir));
    }
protected function getMagentoDbConnection ( $ dir , $ connectionName = 'default' ) { // load the magento environment $ env = require $ this -> getMagentoEnv ( $ dir ) ; // query whether or not, the requested connection is available if ( isset ( $ env [ MagentoConfigurationKeys :: DB ] [ MagentoConfigurationKeys :: CONNECTION ] [ $ connectionName ] ) ) { // load the connection data $ connection = $ env [ MagentoConfigurationKeys :: DB ] [ MagentoConfigurationKeys :: CONNECTION ] [ $ connectionName ] ; // create and return a new database configuration return $ this -> newDatabaseConfiguration ( $ this -> newDsn ( $ connection [ MagentoConfigurationKeys :: HOST ] , $ connection [ MagentoConfigurationKeys :: DBNAME ] ) , $ connection [ MagentoConfigurationKeys :: USERNAME ] , $ connection [ MagentoConfigurationKeys :: PASSWORD ] , false ) ; } // throw an execption if not throw new \ Exception ( sprintf ( 'Requested Magento DB connection "%s" not found in Magento "%s"' , $ connectionName , $ dir ) ) ; }
Return's the requested Magento DB connction data.

@param string $dir            The path to the Magento root directory
@param string $connectionName The connection name to return the data for

@return array The connection data
@throws \Exception Is thrown, if the requested DB connection is not available
Return s the requested Magento DB connction data .