ConnectionManager
class ConnectionManager extends ConnectionManager
Database connection manager.
Traits
Properties
protected string | $default | Name of the default connection. | from ConfigurableTrait |
protected array | $configurations | Configurations. | from ConfigurableTrait |
protected array | $connections | Connections. | from ConnectionManager |
protected array | $driverAliases | Driver aliases. | |
protected array | $connectionClasses | Connections. | |
protected array | $queryCompilerClasses | Query compilers. | |
protected array | $queryBuilderHelperClasses | Query builder helpers. |
Methods
Connects to the chosen database and returns the connection.
No description
Executes the passed closure using the chosen connection before closing it.
Magic shortcut to the default connection.
Returns the normalized driver name.
Returns the connection class.
Retuns the query compiler class.
Retuns the query builder helper class.
Sets a driver alias.
Sets a connection class.
Sets a query compiler class.
Sets a query builder helper class.
Clears the query log of every connection.
Returns the query log for all connections.
Details
in ConfigurableTrait at line 35
__construct(string $default, array $configurations)
Constructor.
in ConfigurableTrait at line 48
addConfiguration(string $name, array $configuration)
Adds a configuration.
in ConfigurableTrait at line 59
removeConfiguration(string $name)
Removes a configuration.
It will also remove any active connection linked to the configuration.
at line 196
protected mixed
connect(string $connectionName)
Connects to the chosen database and returns the connection.
at line 40
Connection
connection($connection = null)
in ConnectionManager at line 62
close(string|null $connection = null)
Closes the chosen connection.
in ConnectionManager at line 87
mixed
executeAndClose(Closure $closure, string|null $connection = null)
Executes the passed closure using the chosen connection before closing it.
in ConnectionManager at line 116
mixed
__call(string $name, array $arguments)
Magic shortcut to the default connection.
at line 100
protected string
normalizeDriverName(string $driver)
Returns the normalized driver name.
at line 119
protected string
getConnectionClass(string $driver)
Returns the connection class.
at line 130
protected string
getQueryCompilerClass(string $driver)
Retuns the query compiler class.
at line 141
protected string
getQueryBuilderHelperClass(string $driver)
Retuns the query builder helper class.
at line 152
setDriverAlias(string $driver, array|string $alias)
Sets a driver alias.
at line 163
setConnectionClass(string $driver, string $class)
Sets a connection class.
at line 174
setQueryCompilerClass(string $driver, string $class)
Sets a query compiler class.
at line 185
setQueryBuilderHelperClass(string $driver, string $class)
Sets a query builder helper class.
at line 222
ConnectionManager
setConnection(Connection $connection)
Adds a database connection to the connection manager.
at line 232
clearLogs()
Clears the query log of every connection.
at line 246
array
getLogs(bool $groupedByConnection = true)
Returns the query log for all connections.