class DatabaseManager implements ConnectionRegistry (View source)

Properties

protected Application $app

The application instance.

protected ConnectionFactory $factory

The database connection factory instance.

protected Connection[] $connections

The active connection instances.

protected array $extensions

The custom connection resolvers.

Methods

__construct(Application $app, ConnectionFactory $factory)

Create a new database manager instance.

getActiveConnection() deprecated

Legacy entry point.

get() deprecated

Legacy entry point.

connection(string $name = null)

Get a database connection instance.

purge(string $name = null)

Disconnect from the given database and remove from local cache.

disconnect(string $name = null)

Disconnect from the given database.

reconnect(string $name = null)

Reconnect to the given database.

refreshPdoConnections(string $name)

Refresh the PDO connections on a given connection.

makeConnection(string $name)

Make the database connection instance.

prepare(Connection $connection)

Prepare the database connection instance.

array
getConfig(string $name)

Get the configuration for a connection.

string
getDefaultConnection()

Get the default connection name.

setDefaultConnection(string $name)

Set the default connection name.

extend(string $name, callable $resolver)

Register an extension connection resolver.

getConnections()

Return all of the created connections.

mixed
__call(string $method, array $parameters)

Dynamically pass methods to the default connection.

getFactory()

No description

getConnection($name = null)

No description

getConnectionNames()

No description

getDefaultConnectionName()

No description

Details

__construct(Application $app, ConnectionFactory $factory)

Create a new database manager instance.

Parameters

Application $app
ConnectionFactory $factory

Connection getActiveConnection() deprecated

deprecated

Legacy entry point.

Return Value

Connection

Connection get() deprecated

deprecated

Legacy entry point.

Return Value

Connection

Connection connection(string $name = null)

Get a database connection instance.

Parameters

string $name

Return Value

Connection

purge(string $name = null)

Disconnect from the given database and remove from local cache.

Parameters

string $name

disconnect(string $name = null)

Disconnect from the given database.

Parameters

string $name

Connection reconnect(string $name = null)

Reconnect to the given database.

Parameters

string $name

Return Value

Connection

protected Connection refreshPdoConnections(string $name)

Refresh the PDO connections on a given connection.

Parameters

string $name

Return Value

Connection

protected Connection makeConnection(string $name)

Make the database connection instance.

Parameters

string $name

Return Value

Connection

protected Connection prepare(Connection $connection)

Prepare the database connection instance.

Parameters

Connection $connection

Return Value

Connection

protected array getConfig(string $name)

Get the configuration for a connection.

Parameters

string $name

Return Value

array

Exceptions

InvalidArgumentException

string getDefaultConnection()

Get the default connection name.

Return Value

string

setDefaultConnection(string $name)

Set the default connection name.

Parameters

string $name

extend(string $name, callable $resolver)

Register an extension connection resolver.

Parameters

string $name
callable $resolver

Connection[] getConnections()

Return all of the created connections.

Return Value

Connection[]

mixed __call(string $method, array $parameters)

Dynamically pass methods to the default connection.

Parameters

string $method
array $parameters

Return Value

mixed

ConnectionFactory getFactory()

No description

Return Value

ConnectionFactory

getConnection($name = null)

No description

Parameters

$name

getConnectionNames()

No description

getDefaultConnectionName()

No description