class Illuminate / Database / DatabaseManager
You're browsing the documentation for an upcoming version of Laravel. The documentation and features of this release are subject to change.

DatabaseManager

Implements

Uses

Properties

protected

$app Application

The application instance.

Default: null
protected

$factory ConnectionFactory

The database connection factory instance.

Default: null
protected

$connections array

The active connection instances.

Default: []
protected

$extensions array

The custom connection resolvers.

Default: []
protected

$reconnector callable

The callback to be executed to reconnect to a database.

Default: null
protected

$doctrineTypes array

The custom Doctrine column types.

Default: []

Methods

public

__construct ( $app , ConnectionFactory $factory ) : void

Create a new database manager instance.

Parameters

public

connection ( $name ) : Connection

Get a database connection instance.

Parameters

  • $name string|null
protected

parseConnectionName ( $name ) : array

Parse the connection into an array of the name and read / write type.

Parameters

  • $name string
protected

makeConnection ( $name ) : Connection

Make the database connection instance.

Parameters

  • $name string
protected

configuration ( $name ) : array

Get the configuration for a connection.

Parameters

  • $name string
protected

configure ( Connection $connection , $type ) : Connection

Prepare the database connection instance.

Parameters

protected

setPdoForType ( Connection $connection , $type ) : Connection

Prepare the read / write mode for database connection instance.

Parameters

protected

registerConfiguredDoctrineTypes ( Connection $connection ) : void

Register custom Doctrine types with the connection.

Parameters

public

registerDoctrineType ( string $class , string $name , string $type ) : void

Register a custom Doctrine type.

Parameters

  • $class string
  • $name string
  • $type string
public

purge ( $name ) : void

Disconnect from the given database and remove from local cache.

Parameters

  • $name string|null
public

disconnect ( $name ) : void

Disconnect from the given database.

Parameters

  • $name string|null
public

reconnect ( $name ) : Connection

Reconnect to the given database.

Parameters

  • $name string|null
public

usingConnection ( $name , callable $callback ) : mixed

Set the default database connection for the callback execution.

Parameters

  • $name string
  • $callback callable
protected

refreshPdoConnections ( $name ) : Connection

Refresh the PDO connections on a given connection.

Parameters

  • $name string
public

getDefaultConnection ( ) : string

Get the default connection name.

public

setDefaultConnection ( $name ) : void

Set the default connection name.

Parameters

  • $name string
public

supportedDrivers ( ) : string[]

Get all of the support drivers.

public

availableDrivers ( ) : string[]

Get all of the drivers that are actually available.

public

extend ( $name , callable $resolver ) : void

Register an extension connection resolver.

Parameters

  • $name string
  • $resolver callable
public

forgetExtension ( $name ) : void

Remove an extension connection resolver.

Parameters

  • $name string
public

getConnections ( ) : array

Return all of the created connections.

public

setReconnector ( callable $reconnector ) : void

Set the database reconnector callback.

Parameters

  • $reconnector callable
public

setApplication ( $app ) : $this

Set the application instance used by the manager.

Parameters

public

__call ( $method , $parameters ) : mixed

Dynamically pass methods to the default connection.

Parameters

  • $method string
  • $parameters array