ConnectionFactory
class ConnectionFactory (View source)
Properties
protected Container | $container | The IoC container instance. |
Methods
Establish a PDO connection based on the configuration.
Parse and prepare the database configuration.
Create a single database connection instance.
Create a read / write database connection instance.
Create a new PDO instance for reading.
Get the read configuration for a read / write connection.
Get the write configuration for a read / write connection.
Get a read / write level configuration.
Merge a configuration for a read / write connection.
Create a new Closure that resolves to a PDO instance.
Create a new Closure that resolves to a PDO instance with a specific host or an array of hosts.
Parse the hosts configuration item into an array.
Create a new Closure that resolves to a PDO instance where there is no configured host.
Create a connector instance based on the configuration.
Create a new connection instance.
Details
void
__construct(Container $container)
Create a new connection factory instance.
Connection
make(array $config, string|null $name = null)
Establish a PDO connection based on the configuration.
protected array
parseConfig(array $config, string $name)
Parse and prepare the database configuration.
protected Connection
createSingleConnection(array $config)
Create a single database connection instance.
protected Connection
createReadWriteConnection(array $config)
Create a read / write database connection instance.
protected Closure
createReadPdo(array $config)
Create a new PDO instance for reading.
protected array
getReadConfig(array $config)
Get the read configuration for a read / write connection.
protected array
getWriteConfig(array $config)
Get the write configuration for a read / write connection.
protected array
getReadWriteConfig(array $config, string $type)
Get a read / write level configuration.
protected array
mergeReadWriteConfig(array $config, array $merge)
Merge a configuration for a read / write connection.
protected Closure
createPdoResolver(array $config)
Create a new Closure that resolves to a PDO instance.
protected Closure
createPdoResolverWithHosts(array $config)
Create a new Closure that resolves to a PDO instance with a specific host or an array of hosts.
protected array
parseHosts(array $config)
Parse the hosts configuration item into an array.
protected Closure
createPdoResolverWithoutHosts(array $config)
Create a new Closure that resolves to a PDO instance where there is no configured host.
ConnectorInterface
createConnector(array $config)
Create a connector instance based on the configuration.
protected Connection
createConnection(string $driver, PDO|Closure $connection, string $database, string $prefix = '', array $config = [])
Create a new connection instance.