interface ManagerRegistry implements ConnectionRegistry (View source)

Contract covering object managers for a Doctrine persistence layer ManagerRegistry class to implement.

Methods

string
getDefaultConnectionName()

Gets the default connection name.

object
getConnection(string $name = null)

Gets the named connection.

array
getConnections()

Gets an array of all registered connections.

array
getConnectionNames()

Gets all connection names.

string
getDefaultManagerName()

Gets the default object manager name.

getManager(string $name = null)

Gets a named object manager.

getManagers()

Gets an array of all registered object managers.

resetManager(string|null $name = null)

Resets a named object manager.

string
getAliasNamespace(string $alias)

Resolves a registered namespace alias to the full namespace.

array
getManagerNames()

Gets all object manager names.

getRepository(string $persistentObject, string $persistentManagerName = null)

Gets the ObjectRepository for a persistent object.

getManagerForClass(string $class)

Gets the object manager associated with a given class.

Details

string getDefaultConnectionName()

Gets the default connection name.

Return Value

string The default connection name.

object getConnection(string $name = null)

Gets the named connection.

Parameters

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

Return Value

object

array getConnections()

Gets an array of all registered connections.

Return Value

array An array of Connection instances.

array getConnectionNames()

Gets all connection names.

Return Value

array An array of connection names.

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[] getManagers()

Gets an array of all registered object managers.

Return Value

ObjectManager[] An array of ObjectManager instances

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

string getAliasNamespace(string $alias)

Resolves a registered namespace alias to the full namespace.

This method looks for the alias in all registered object managers.

Parameters

string $alias The alias.

Return Value

string The full namespace.

array getManagerNames()

Gets all object manager names.

Return Value

array An array of object manager names.

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

Gets the ObjectRepository for a persistent object.

Parameters

string $persistentObject The name of the persistent object.
string $persistentManagerName The object manager name (null for the default one).

Return Value

ObjectRepository

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