DatabaseManager
Implements
Properties
$connections array
The active connection instances.
$extensions array
The custom connection resolvers.
$reconnector callable
The callback to be executed to reconnect to a database.
$doctrineTypes array
The custom Doctrine column types.
Methods
__construct ( $app , ConnectionFactory $factory ) : void
Create a new database manager instance.
Parameters
- $app Application
- $factory ConnectionFactory
connection ( $name ) : Connection
Get a database connection instance.
Parameters
- $name string|null
parseConnectionName ( $name ) : array
Parse the connection into an array of the name and read / write type.
Parameters
- $name string
makeConnection ( $name ) : Connection
Make the database connection instance.
Parameters
- $name string
configuration ( $name ) : array
Get the configuration for a connection.
Parameters
- $name string
configure ( Connection $connection , $type ) : Connection
Prepare the database connection instance.
Parameters
- $connection Connection
- $type string
setPdoForType ( Connection $connection , $type ) : Connection
Prepare the read / write mode for database connection instance.
Parameters
- $connection Connection
- $type string|null
registerConfiguredDoctrineTypes ( Connection $connection ) : void
Register custom Doctrine types with the connection.
Parameters
- $connection Connection
registerDoctrineType ( string $class , string $name , string $type ) : void
Register a custom Doctrine type.
Parameters
- $class string
- $name string
- $type string
purge ( $name ) : void
Disconnect from the given database and remove from local cache.
Parameters
- $name string|null
disconnect ( $name ) : void
Disconnect from the given database.
Parameters
- $name string|null
reconnect ( $name ) : Connection
Reconnect to the given database.
Parameters
- $name string|null
usingConnection ( $name , callable $callback ) : mixed
Set the default database connection for the callback execution.
Parameters
- $name string
- $callback callable
refreshPdoConnections ( $name ) : Connection
Refresh the PDO connections on a given connection.
Parameters
- $name string
getDefaultConnection ( ) : string
Get the default connection name.
setDefaultConnection ( $name ) : void
Set the default connection name.
Parameters
- $name string
supportedDrivers ( ) : array
Get all of the support drivers.
availableDrivers ( ) : array
Get all of the drivers that are actually available.
extend ( $name , callable $resolver ) : void
Register an extension connection resolver.
Parameters
- $name string
- $resolver callable
getConnections ( ) : array
Return all of the created connections.
setReconnector ( callable $reconnector ) : void
Set the database reconnector callback.
Parameters
- $reconnector callable
setApplication ( $app ) : $this
Set the application instance used by the manager.
Parameters
- $app Application
__call ( $method , $parameters ) : mixed
Dynamically pass methods to the default connection.
Parameters
- $method string
- $parameters array