abstract class AbstractManagerRegistry implements ManagerRegistry (View source)

Abstract implementation of the ManagerRegistry contract.

Methods

__construct(string $name, array $connections, array $managers, string $defaultConnection, string $defaultManager, string $proxyInterfaceName)

No description

object
getService(string $name)

Fetches/creates the given services.

void
resetService(string $name)

Resets the given services.

string
getName()

Gets the name of the registry.

object
getConnection(string $name = null)

Gets the named connection.

string[]
getConnectionNames()

Gets all connection names.

object[]
getConnections()

Gets an array of all registered connections.

string
getDefaultConnectionName()

Gets the default connection name.

string
getDefaultManagerName()

Gets the default object manager name.

getManager(string $name = null)

Gets a named object manager.

getManagerForClass(string $class)

Gets the object manager associated with a given class.

string[]
getManagerNames()

Gets all object manager names.

getManagers()

Gets an array of all registered object managers.

getRepository($persistentObjectName, string $persistentManagerName = null)

Gets the ObjectRepository for a persistent object.

resetManager(string|null $name = null)

Resets a named object manager.

Details

__construct(string $name, array $connections, array $managers, string $defaultConnection, string $defaultManager, string $proxyInterfaceName)

Parameters

string $name
array $connections
array $managers
string $defaultConnection
string $defaultManager
string $proxyInterfaceName

abstract protected object getService(string $name)

Fetches/creates the given services.

A service in this context is connection or a manager instance.

Parameters

string $name The name of the service.

Return Value

object The instance of the given service.

abstract protected void resetService(string $name)

Resets the given services.

A service in this context is connection or a manager instance.

Parameters

string $name The name of the service.

Return Value

void

string getName()

Gets the name of the registry.

Return Value

string

object getConnection(string $name = null)

Gets the named connection.

Parameters

string $name The connection name (null for the default one).

Return Value

object

string[] getConnectionNames()

Gets all connection names.

Return Value

string[] An array of connection names.

object[] getConnections()

Gets an array of all registered connections.

Return Value

object[] An array of Connection instances.

string getDefaultConnectionName()

Gets the default connection name.

Return Value

string The default connection name.

string getDefaultManagerName()

Gets the default object manager name.

Return Value

string The default object manager name.

ObjectManager getManager(string $name = null)

Gets a named object manager.

Parameters

string $name The object manager name (null for the default one).

Return Value

ObjectManager

ObjectManager|null getManagerForClass(string $class)

Gets the object manager associated with a given class.

Parameters

string $class A persistent object class name.

Return Value

ObjectManager|null

string[] getManagerNames()

Gets all object manager names.

Return Value

string[] An array of object manager names.

ObjectManager[] getManagers()

Gets an array of all registered object managers.

Return Value

ObjectManager[] An array of ObjectManager instances

ObjectRepository getRepository($persistentObjectName, string $persistentManagerName = null)

Gets the ObjectRepository for a persistent object.

Parameters

$persistentObjectName
string $persistentManagerName The object manager name (null for the default one).

Return Value

ObjectRepository

ObjectManager resetManager(string|null $name = null)

Resets a named object manager.

This method is useful when an object manager has been closed because of a rollbacked transaction AND when you think that it makes sense to get a new one to replace the closed one.

Be warned that you will get a brand new object manager as the existing one is not useable anymore. This means that any other object with a dependency on this object manager will hold an obsolete reference. You can inject the registry instead to avoid this problem.

Parameters

string|null $name The object manager name (null for the default one).

Return Value

ObjectManager