PHP Class LMongo\ConnectionResolver

Inheritance: implements lmongo\ConnectionResolverInterface
Show file Open project: navruzm/lmongo

Protected Properties

Property Type Description
$connections array All of the registered connections.
$default string The default connection name.

Public Methods

Method Description
__construct ( array $connections = [] ) : void Create a new connection resolver instance.
addConnection ( string $name, Connection $connection ) : void Add a connection to the resolver.
connection ( string $name = null ) : Illuminate\Database\Connection Get a database connection instance.
getDefaultConnection ( ) : string Get the default connection name.
hasConnection ( string $name ) : boolean Check if a connection has been registered.
setDefaultConnection ( string $name ) : void Set the default connection name.

Method Details

__construct() public method

Create a new connection resolver instance.
public __construct ( array $connections = [] ) : void
$connections array
return void

addConnection() public method

Add a connection to the resolver.
public addConnection ( string $name, Connection $connection ) : void
$name string
$connection Connection
return void

connection() public method

Get a database connection instance.
public connection ( string $name = null ) : Illuminate\Database\Connection
$name string
return Illuminate\Database\Connection

getDefaultConnection() public method

Get the default connection name.
public getDefaultConnection ( ) : string
return string

hasConnection() public method

Check if a connection has been registered.
public hasConnection ( string $name ) : boolean
$name string
return boolean

setDefaultConnection() public method

Set the default connection name.
public setDefaultConnection ( string $name ) : void
$name string
return void

Property Details

$connections protected property

All of the registered connections.
protected array $connections
return array

$default protected property

The default connection name.
protected string $default
return string