PHP Class Symfony\Bundle\DoctrineBundle\Registry

Author: Fabien Potencier ([email protected])
Inheritance: implements Symfony\Bridge\Doctrine\RegistryInterface
Exibir arquivo Open project: pmjones/php-framework-benchmarks Class Usage Examples

Public Methods

Method Description
__construct ( Symfony\Component\DependencyInjection\ContainerInterface $container, array $connections, array $entityManagers, $defaultConnection, $defaultEntityManager )
getConnection ( string $name = null ) : Doctrine\DBAL\Connection Gets the named connection.
getConnectionNames ( ) : array Gets all connection names.
getConnections ( ) : array Gets an array of all registered connections
getDefaultConnectionName ( ) : string Gets the default connection name.
getDefaultEntityManagerName ( ) : string Gets the default entity manager name.
getEntityManager ( string $name = null ) : EntityManager Gets a named entity manager.
getEntityManagerNames ( ) : array Gets all connection names.
getEntityManagers ( ) : array Gets an array of all registered entity managers
getEntityNamespace ( string $alias ) : string Resolves a registered namespace alias to the full namespace.
getRepository ( string $entityName, $entityManagerName = null ) : Doctrine\ORM\EntityRepository Gets the EntityRepository for an entity.
resetEntityManager ( string $name = null ) : EntityManager Resets a named entity manager.

Method Details

__construct() public method

public __construct ( Symfony\Component\DependencyInjection\ContainerInterface $container, array $connections, array $entityManagers, $defaultConnection, $defaultEntityManager )
$container Symfony\Component\DependencyInjection\ContainerInterface
$connections array
$entityManagers array

getConnection() public method

Gets the named connection.
public getConnection ( string $name = null ) : Doctrine\DBAL\Connection
$name string The connection name (null for the default one)
return Doctrine\DBAL\Connection

getConnectionNames() public method

Gets all connection names.
public getConnectionNames ( ) : array
return array An array of connection names

getConnections() public method

Gets an array of all registered connections
public getConnections ( ) : array
return array An array of Connection instances

getDefaultConnectionName() public method

Gets the default connection name.
public getDefaultConnectionName ( ) : string
return string The default connection name

getDefaultEntityManagerName() public method

Gets the default entity manager name.
public getDefaultEntityManagerName ( ) : string
return string The default entity manager name

getEntityManager() public method

Gets a named entity manager.
public getEntityManager ( string $name = null ) : EntityManager
$name string The entity manager name (null for the default one)
return EntityManager

getEntityManagerNames() public method

Gets all connection names.
public getEntityManagerNames ( ) : array
return array An array of connection names

getEntityManagers() public method

Gets an array of all registered entity managers
public getEntityManagers ( ) : array
return array An array of EntityManager instances

getEntityNamespace() public method

This method looks for the alias in all registered entity managers.
See also: Configuration::getEntityNamespace
public getEntityNamespace ( string $alias ) : string
$alias string The alias
return string The full namespace

getRepository() public method

Gets the EntityRepository for an entity.
public getRepository ( string $entityName, $entityManagerName = null ) : Doctrine\ORM\EntityRepository
$entityName string The name of the entity.
return Doctrine\ORM\EntityRepository

resetEntityManager() public method

This method is useful when an entity 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 entity manager as the existing one is not useable anymore. This means that any other object with a dependency on this entity manager will hold an obsolete reference. You can inject the registry instead to avoid this problem.
public resetEntityManager ( string $name = null ) : EntityManager
$name string The entity manager name (null for the default one)
return EntityManager