class GenericConnectionProvider implements ConnectionProvider (View source)

A generic lazy loading connector that can take any kind of PDO data source name.

Methods

__construct(string $dsn, string $username, string $password, array $options)

GenericConnectionProvider constructor.

PDO
getConnection()

Provides the active PDO connection and initializes it if necessary.

PDO
initializeConnection()

Initializes the PDO connection when first requested.

Details

__construct(string $dsn, string $username, string $password, array $options)

GenericConnectionProvider constructor.

Parameters

string $dsn The data source name for the PDO connection
string $username The username for the PDO connection
string $password The password for the PDO connection
array $options Initial PDO options provided when initializing the connection

PDO getConnection()

Provides the active PDO connection and initializes it if necessary.

Return Value

PDO An active PDO connection

protected PDO initializeConnection()

Initializes the PDO connection when first requested.

Return Value

PDO The initialized PDO connection