ManagerRegistry
extends
ConnectionRegistry
in
Contract covering object managers for a Doctrine persistence layer ManagerRegistry class to implement.
Table of Contents
- getAliasNamespace() : string
- Resolves a registered namespace alias to the full namespace.
- getConnection() : object
- Gets the named connection.
- getConnectionNames() : array<string|int, string>
- Gets all connection names.
- getConnections() : array<string|int, object>
- Gets an array of all registered connections.
- getDefaultConnectionName() : string
- Gets the default connection name.
- getDefaultManagerName() : string
- Gets the default object manager name.
- getManager() : ObjectManager
- Gets a named object manager.
- getManagerForClass() : ObjectManager|null
- Gets the object manager associated with a given class.
- getManagerNames() : array<string|int, string>
- Gets all object manager names.
- getManagers() : array<string|int, ObjectManager>
- Gets an array of all registered object managers.
- getRepository() : ObjectRepository
- Gets the ObjectRepository for a persistent object.
- resetManager() : ObjectManager
- Resets a named object manager.
Methods
getAliasNamespace()
Resolves a registered namespace alias to the full namespace.
public
getAliasNamespace(string $alias) : string
This method looks for the alias in all registered object managers.
Parameters
- $alias : string
-
The alias.
Return values
string —The full namespace.
getConnection()
Gets the named connection.
public
getConnection([string $name = null ]) : object
Parameters
- $name : string = null
-
The connection name (null for the default one).
Return values
object —getConnectionNames()
Gets all connection names.
public
getConnectionNames() : array<string|int, string>
Return values
array<string|int, string> —An array of connection names.
getConnections()
Gets an array of all registered connections.
public
getConnections() : array<string|int, object>
Return values
array<string|int, object> —An array of Connection instances.
getDefaultConnectionName()
Gets the default connection name.
public
getDefaultConnectionName() : string
Return values
string —The default connection name.
getDefaultManagerName()
Gets the default object manager name.
public
getDefaultManagerName() : string
Return values
string —The default object manager name.
getManager()
Gets a named object manager.
public
getManager([string $name = null ]) : ObjectManager
Parameters
- $name : string = null
-
The object manager name (null for the default one).
Return values
ObjectManager —getManagerForClass()
Gets the object manager associated with a given class.
public
getManagerForClass(string $class) : ObjectManager|null
Parameters
- $class : string
-
A persistent object class name.
Return values
ObjectManager|null —getManagerNames()
Gets all object manager names.
public
getManagerNames() : array<string|int, string>
Return values
array<string|int, string> —An array of object manager names.
getManagers()
Gets an array of all registered object managers.
public
getManagers() : array<string|int, ObjectManager>
Return values
array<string|int, ObjectManager> —An array of ObjectManager instances
getRepository()
Gets the ObjectRepository for a persistent object.
public
getRepository(string $persistentObject[, string $persistentManagerName = null ]) : ObjectRepository
Parameters
- $persistentObject : string
-
The name of the persistent object.
- $persistentManagerName : string = null
-
The object manager name (null for the default one).
Tags
Return values
ObjectRepository —resetManager()
Resets a named object manager.
public
resetManager([string|null $name = null ]) : ObjectManager
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
- $name : string|null = null
-
The object manager name (null for the default one).