src/Gossamer/Pesedget/Database/DatasourceFactory.php
private function buildDatasourceInstance($sourceName, Logger $logger) {
        $parser = new YAMLParser($logger);
        $ymlFilePath = __SITE_PATH . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'credentials.yml';
        $parser->setFilePath($ymlFilePath);
        $dsConfig = $parser->loadConfig();
        $sourceName = trim($sourceName, "<br>");

        $datasourceClass = $dsConfig['database'][$sourceName]['class'];

        $datasource = new $datasourceClass($dsConfig['database'][$sourceName]['credentials']);
        $datasource->setLogger($logger);
   
        unset($parser);
        
        return $datasource;
    }
private function buildDatasourceInstance($sourceName, Logger $logger) {
        $parser = new YAMLParser($logger);
        $ymlFilePath = __SITE_PATH . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'credentials.yml';
        $parser->setFilePath($ymlFilePath);
        $dsConfig = $parser->loadConfig();
        $sourceName = trim($sourceName, "<br>");

        $datasourceClass = $dsConfig['database'][$sourceName]['class'];

        $datasource = new $datasourceClass($dsConfig['database'][$sourceName]['credentials']);
        $datasource->setLogger($logger);
   
        unset($parser);
        
        return $datasource;
    }
private function buildDatasourceInstance ( $ sourceName , Logger $ logger ) { $ parser = new YAMLParser ( $ logger ) ; $ ymlFilePath = __SITE_PATH . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'credentials.yml' ; $ parser -> setFilePath ( $ ymlFilePath ) ; $ dsConfig = $ parser -> loadConfig ( ) ; $ sourceName = trim ( $ sourceName , "<br>" ) ; $ datasourceClass = $ dsConfig [ 'database' ] [ $ sourceName ] [ 'class' ] ; $ datasource = new $ datasourceClass ( $ dsConfig [ 'database' ] [ $ sourceName ] [ 'credentials' ] ) ; $ datasource -> setLogger ( $ logger ) ; unset ( $ parser ) ; return $ datasource ; }
creates a datasource based on the credentials.yml configuration

@param type $sourceName
@param Logger $logger

@return \core\datasources\datasourceClass
creates a datasource based on the credentials . yml configuration