public function getConnection($database = null)
    {
        $buildConnection = $this->getBuildConnection($database);

        //Still useful ?
        //$dsn = str_replace("@DB@", $database, $buildConnection['dsn']);
        $dsn = $buildConnection['dsn'];

        // Set user + password to null if they are empty strings or missing
        $username = isset($buildConnection['user']) && $buildConnection['user'] ? $buildConnection['user'] : null;
        $password = isset($buildConnection['password']) && $buildConnection['password'] ? $buildConnection['password'] : null;

        // Get options from and config and default to null
        $options = isset($buildConnection['options']) && is_array($buildConnection['options']) ? $buildConnection['options'] : null;

        $con = ConnectionFactory::create(['dsn' => $dsn, 'user' => $username, 'password' => $password, 'options' => $options], AdapterFactory::create($buildConnection['adapter']));

        return $con;
    }
public function getConnection($database = null)
    {
        $buildConnection = $this->getBuildConnection($database);

        //Still useful ?
        //$dsn = str_replace("@DB@", $database, $buildConnection['dsn']);
        $dsn = $buildConnection['dsn'];

        // Set user + password to null if they are empty strings or missing
        $username = isset($buildConnection['user']) && $buildConnection['user'] ? $buildConnection['user'] : null;
        $password = isset($buildConnection['password']) && $buildConnection['password'] ? $buildConnection['password'] : null;

        // Get options from and config and default to null
        $options = isset($buildConnection['options']) && is_array($buildConnection['options']) ? $buildConnection['options'] : null;

        $con = ConnectionFactory::create(['dsn' => $dsn, 'user' => $username, 'password' => $password, 'options' => $options], AdapterFactory::create($buildConnection['adapter']));

        return $con;
    }
public function getConnection ( $ database = null ) { $ buildConnection = $ this -> getBuildConnection ( $ database ) ; //Still useful ? //$dsn = str_replace("@DB@", $database, $buildConnection['dsn']); $ dsn = $ buildConnection [ 'dsn' ] ; // Set user + password to null if they are empty strings or missing $ username = isset ( $ buildConnection [ 'user' ] ) && $ buildConnection [ 'user' ] ? $ buildConnection [ 'user' ] : null ; $ password = isset ( $ buildConnection [ 'password' ] ) && $ buildConnection [ 'password' ] ? $ buildConnection [ 'password' ] : null ; // Get options from and config and default to null $ options = isset ( $ buildConnection [ 'options' ] ) && is_array ( $ buildConnection [ 'options' ] ) ? $ buildConnection [ 'options' ] : null ; $ con = ConnectionFactory :: create ( [ 'dsn' => $ dsn , 'user' => $ username , 'password' => $ password , 'options' => $ options ] , AdapterFactory :: create ( $ buildConnection [ 'adapter' ] ) ) ; return $ con ; }
Return a connection object of a given database name

@param  string              $database
@return ConnectionInterface
Return a connection object of a given database name