Registry
extends ManagerRegistry
in package
implements
ResetInterface
References all Doctrine connections and entity managers in a given Container.
Table of Contents
Interfaces
- ResetInterface
- Provides a way to reset an object to its initial state.
Properties
- $container : Container
- $connections : array<string, string>
- $defaultConnection : string
- $defaultManager : string
- $managers : array<string, string>
- $name : string
- $proxyInterfaceName : string
Methods
- __construct() : mixed
- getAliasNamespace() : string
- Resolves a registered namespace alias to the full namespace.
- getConnection() : mixed
- {@inheritdoc}
- getConnectionNames() : mixed
- {@inheritdoc}
- getConnections() : mixed
- {@inheritdoc}
- getDefaultConnectionName() : mixed
- {@inheritdoc}
- 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, string>
- Gets all object manager names and associated service IDs. A service ID is a string that allows to obtain an object manager, typically from a PSR-11 container.
- getManagers() : array<string, ObjectManager>
- Gets an array of all registered object managers.
- getName() : string
- Gets the name of the registry.
- getRepository() : ObjectRepository
- Gets the ObjectRepository for a persistent object.
- reset() : void
- resetManager() : ObjectManager
- Resets a named object manager.
- getService() : ObjectManager
- Fetches/creates the given services.
- resetService() : void
- Resets the given services.
- resetOrClearManager() : void
- selectManager() : ObjectManager
Properties
$container
protected
Container
$container
$connections
private
array<string, string>
$connections
$defaultConnection
private
string
$defaultConnection
$defaultManager
private
string
$defaultManager
$managers
private
array<string, string>
$managers
$name
private
string
$name
$proxyInterfaceName
private
string
$proxyInterfaceName
Tags
Methods
__construct()
public
__construct(ContainerInterface $container, array<string|int, string> $connections, array<string|int, string> $entityManagers, string $defaultConnection, string $defaultEntityManager) : mixed
Parameters
- $container : ContainerInterface
- $connections : array<string|int, string>
- $entityManagers : array<string|int, string>
- $defaultConnection : string
- $defaultEntityManager : string
getAliasNamespace()
Resolves a registered namespace alias to the full namespace.
public
getAliasNamespace(string $alias) : string
This method looks for the alias in all registered entity managers.
Parameters
- $alias : string
-
The alias
Tags
Return values
string —The full namespace
getConnection()
{@inheritdoc}
public
getConnection([string|null $name = null ]) : mixed
Parameters
- $name : string|null = null
getConnectionNames()
{@inheritdoc}
public
getConnectionNames() : mixed
getConnections()
{@inheritdoc}
public
getConnections() : mixed
getDefaultConnectionName()
{@inheritdoc}
public
getDefaultConnectionName() : mixed
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|null $name = null ]) : ObjectManager
Parameters
- $name : string|null = null
-
The object manager name (null for the default one).
Tags
Return values
ObjectManagergetManagerForClass()
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|nullgetManagerNames()
Gets all object manager names and associated service IDs. A service ID is a string that allows to obtain an object manager, typically from a PSR-11 container.
public
getManagerNames() : array<string, string>
Return values
array<string, string> —An array with object manager names as keys, and service IDs as values.
getManagers()
Gets an array of all registered object managers.
public
getManagers() : array<string, ObjectManager>
Return values
array<string, ObjectManager> —An array of ObjectManager instances
getName()
Gets the name of the registry.
public
getName() : string
Return values
stringgetRepository()
Gets the ObjectRepository for a persistent object.
public
getRepository(string $persistentObject[, string|null $persistentManagerName = null ]) : ObjectRepository
Parameters
- $persistentObject : string
-
The name of the persistent object.
- $persistentManagerName : string|null = null
-
The object manager name (null for the default one).
Return values
ObjectRepositoryreset()
public
reset() : void
resetManager()
Resets a named object manager.
public
resetManager([string|null $name = null ]) : ObjectManager
Parameters
- $name : string|null = null
-
The object manager name (null for the default one).
Return values
ObjectManagergetService()
Fetches/creates the given services.
protected
abstract getService(string $name) : ObjectManager
A service in this context is connection or a manager instance.
Parameters
- $name : string
-
The name of the service.
Return values
ObjectManager —The instance of the given service.
resetService()
Resets the given services.
protected
abstract resetService(string $name) : void
A service in this context is connection or a manager instance.
Parameters
- $name : string
-
The name of the service.
resetOrClearManager()
private
resetOrClearManager(string $managerName, string $serviceId) : void
Parameters
- $managerName : string
- $serviceId : string
selectManager()
private
selectManager(string $persistentObject[, string|null $persistentManagerName = null ]) : ObjectManager
Parameters
- $persistentObject : string
- $persistentManagerName : string|null = null