PHP Class Autarky\Database\ConnectionFactory

Inheritance: implements Autarky\Database\ConnectionFactoryInterface
显示文件 Open project: autarky/framework Class Usage Examples

Protected Properties

Property Type Description
$defaultPdoOptions array The default PDO options.
$instantiator PDOInstantiator PDO instantiator instance.

Public Methods

Method Description
__construct ( PDOInstantiator $instantiator = null ) Constructor.
makePdo ( array $config, string $connection = null ) : PDO Create a new PDO instance.

Protected Methods

Method Description
makeDsn ( $driver, array $values )
makePdoInner ( $dsn, $username, $password, array $options, array $initCommands )
makeSqliteDsn ( $path )
validate ( array &$config, $key, $connection, $allowEmpty = false )

Method Details

__construct() public method

Constructor.
public __construct ( PDOInstantiator $instantiator = null )
$instantiator PDOInstantiator

makeDsn() protected method

protected makeDsn ( $driver, array $values )
$values array

makePdo() public method

Create a new PDO instance.
public makePdo ( array $config, string $connection = null ) : PDO
$config array
$connection string Name of the connection - used for exception messages
return PDO

makePdoInner() protected method

protected makePdoInner ( $dsn, $username, $password, array $options, array $initCommands )
$options array
$initCommands array

makeSqliteDsn() protected method

protected makeSqliteDsn ( $path )

validate() protected method

protected validate ( array &$config, $key, $connection, $allowEmpty = false )
$config array

Property Details

$defaultPdoOptions protected_oe property

The default PDO options.
protected array $defaultPdoOptions
return array

$instantiator protected_oe property

PDO instantiator instance.
protected PDOInstantiator,Autarky\Database $instantiator
return PDOInstantiator