PHP Class Blast\Orm\ConnectionManager

Inheritance: implements Blast\Orm\ConnectionManagerInterface
Mostra file Open project: phpthinktank/blast-orm Class Usage Examples

Protected Properties

Property Type Description
$connections Doctrine\DBAL\Connection[]
$defaultConnection Doctrine\DBAL\Connection
$previousConnections Doctrine\DBAL\Connection[]

Public Methods

Method Description
__destruct ( ) Close all connections on
add ( array | Doctrine\DBAL\Connection | string $connection, string $name = self::DEFAULT_CONNECTION ) Add a new connection to internal cache. Create connection with Blast\Orm\ConnectionManager::create
all ( ) : Doctrine\DBAL\Connection[] | Connection[] Get all connections
closeAll ( ) Disconnect all connections and remove all connections. Collect garbage at least.
create ( $definition ) : Doctrine\DBAL\Connection | Connection Create a new connection from definition.
get ( $name = null ) : Doctrine\DBAL\Connection | Connection Get connection by name.
getInstance ( ) : ConnectionManager Get connection manager instance to share connections between different instances.
getPrevious ( ) : array
has ( $name ) : boolean Check if connections exists
swapActiveConnection ( string $name ) Swap current connection with another connection by name and add previous connection to previous connection stack.

Method Details

__destruct() public method

Close all connections on
public __destruct ( )

add() public method

Add a new connection to internal cache. Create connection with Blast\Orm\ConnectionManager::create
See also: http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#getting-a-connection
public add ( array | Doctrine\DBAL\Connection | string $connection, string $name = self::DEFAULT_CONNECTION )
$connection array | Doctrine\DBAL\Connection | string
$name string

all() public method

Get all connections
public all ( ) : Doctrine\DBAL\Connection[] | Connection[]
return Doctrine\DBAL\Connection[] | Connection[]

closeAll() public method

Disconnect all connections and remove all connections. Collect garbage at least.
public closeAll ( )

create() public static method

If definition is a string, the manager tries to get definition from ioc container, otherwise the manager assumes a valid dsn string and converts definition to an array. If definition is a string manager is determining wrapper class and tries to get wrapper class from container.
public static create ( $definition ) : Doctrine\DBAL\Connection | Connection
$definition
return Doctrine\DBAL\Connection | Connection

get() public method

Get connection by name.
public get ( $name = null ) : Doctrine\DBAL\Connection | Connection
$name
return Doctrine\DBAL\Connection | Connection

getInstance() public static method

Get connection manager instance to share connections between different instances.
public static getInstance ( ) : ConnectionManager
return ConnectionManager

getPrevious() public method

public getPrevious ( ) : array
return array

has() public method

Check if connections exists
public has ( $name ) : boolean
$name
return boolean

swapActiveConnection() public method

Swap current connection with another connection by name and add previous connection to previous connection stack.
public swapActiveConnection ( string $name )
$name string

Property Details

$connections protected_oe property

protected Connection[],Doctrine\DBAL $connections
return Doctrine\DBAL\Connection[]

$defaultConnection protected_oe property

protected Connection,Doctrine\DBAL $defaultConnection
return Doctrine\DBAL\Connection

$previousConnections protected_oe property

protected Connection[],Doctrine\DBAL $previousConnections
return Doctrine\DBAL\Connection[]