PHP Class Autarky\Database\ConnectionManager

Datei anzeigen Open project: autarky/framework

Protected Properties

Property Type Description
$config Autarky\Config\ConfigInterface
$defaultConnection string The default connection to use
$factory ConnectionFactory
$instances PDO[] PDO instances.

Public Methods

Method Description
__construct ( Autarky\Config\ConfigInterface $config, Autarky\Database\ConnectionFactoryInterface $factory, string | null $defaultConnection = null ) Constructor.
getConnectionConfig ( string $connection = null ) : array Get the configuration array for a specific connection.
getPdo ( string | null $connection = null ) : PDO Get a PDO instance.

Method Details

__construct() public method

Constructor.
public __construct ( Autarky\Config\ConfigInterface $config, Autarky\Database\ConnectionFactoryInterface $factory, string | null $defaultConnection = null )
$config Autarky\Config\ConfigInterface
$factory Autarky\Database\ConnectionFactoryInterface
$defaultConnection string | null If null, "database.connection" is retrieved from $config

getConnectionConfig() public method

Get the configuration array for a specific connection.
public getConnectionConfig ( string $connection = null ) : array
$connection string The name of the connection.
return array

getPdo() public method

Get a PDO instance.
public getPdo ( string | null $connection = null ) : PDO
$connection string | null Null fetches the default connection.
return PDO

Property Details

$config protected_oe property

protected ConfigInterface,Autarky\Config $config
return Autarky\Config\ConfigInterface

$defaultConnection protected_oe property

The default connection to use
protected string $defaultConnection
return string

$factory protected_oe property

protected ConnectionFactory,Autarky\Database $factory
return ConnectionFactory

$instances protected_oe property

PDO instances.
protected PDO[] $instances
return PDO[]