本文整理汇总了PHP中Doctrine\Common\Persistence\ManagerRegistry::resetManager方法的典型用法代码示例。如果您正苦于以下问题:PHP ManagerRegistry::resetManager方法的具体用法?PHP ManagerRegistry::resetManager怎么用?PHP ManagerRegistry::resetManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\Common\Persistence\ManagerRegistry
的用法示例。
在下文中一共展示了ManagerRegistry::resetManager方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getEntityManager
/**
* Returns default entity manager
*
* @return EntityManager
*/
protected function getEntityManager()
{
/** @var EntityManager $em */
$em = $this->doctrine->getManager();
if (!$em->isOpen()) {
$this->doctrine->resetManager();
$em = $this->doctrine->getManager();
}
return $em;
}
示例2: cleanUp
public function cleanUp()
{
foreach ($this->managerRegistry->getManagers() as $name => $manager) {
if (!$manager instanceof EntityManager) {
continue;
}
if (!$manager->isOpen()) {
$this->logger->debug('Reset closed EntityManager', ['entity_manager' => $name]);
$this->managerRegistry->resetManager($name);
}
}
}
示例3: process
/**
* {@inheritdoc}
*/
public function process(Message $message, array $options)
{
$result = $this->processor->process($message, $options);
foreach ($this->managerRegistry->getManagers() as $managerName => $manager) {
if (method_exists($manager, 'isOpen') && !$manager->isOpen()) {
$this->managerRegistry->resetManager($managerName);
continue;
}
$manager->clear();
}
return $result;
}