本文整理匯總了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;
}