public resetEntityManager ( string $name = null ) : EntityManager | ||
$name | string | The entity manager name (null for the default one) |
Результат | EntityManager |
public function resetEntityManager($name = null)
{
if (null === $name) {
$name = $this->defaultEntityManager;
}
if (!isset($this->entityManagers[$name])) {
throw new \InvalidArgumentException(sprintf('Doctrine EntityManager named "%s" does not exist.', $name));
}
// force the creation of a new entity manager
// if the current one is closed
$this->container->set($this->entityManagers[$name], null);
}
public function testResetUnknownEntityManager() { $container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface'); $registry = new Registry($container, array(), array(), 'default', 'default'); $this->setExpectedException('InvalidArgumentException', 'Doctrine EntityManager named "default" does not exist.'); $registry->resetEntityManager('default'); }