本文整理汇总了PHP中Doctrine\Bundle\DoctrineBundle\Registry::resetManager方法的典型用法代码示例。如果您正苦于以下问题:PHP Registry::resetManager方法的具体用法?PHP Registry::resetManager怎么用?PHP Registry::resetManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\Bundle\DoctrineBundle\Registry
的用法示例。
在下文中一共展示了Registry::resetManager方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
public function update(Worker $worker)
{
/** @var EntityManager $em */
$em = $this->doctrine->getManager();
$exception = null;
$i = 0;
while ($i < 5) {
try {
$worker = $this->getWorker(['queue' => $worker->getQueue(), 'instance' => $worker->getInstance(), 'host' => $worker->getHost()]);
$em->persist($worker);
$em->flush();
return;
} catch (\Exception $e) {
// the connection might have "gone away"
$this->logger->warning("Error while updating worker entity", ['message' => $e->getMessage()]);
$exception = $e;
$this->doctrine->resetManager();
$em = $this->doctrine->getManager();
$em->getConnection()->close();
$em->getConnection()->connect();
}
$i++;
}
throw new ApplicationException("Unable to update worker entity", $exception);
}
示例2: reset
private function reset()
{
if ($this->doctrine) {
/** @var Connection $c */
$c = $this->doctrine->getConnection();
$c->close();
$this->doctrine->resetManager();
}
}
示例3: testResetUnknownEntityManager
public function testResetUnknownEntityManager()
{
$container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface');
$registry = new Registry($container, array(), array(), 'default', 'default');
$this->setExpectedException('InvalidArgumentException', 'Doctrine ORM Manager named "default" does not exist.');
$registry->resetManager('default');
}