當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Registry::resetManager方法代碼示例

本文整理匯總了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);
 }
開發者ID:keboola,項目名稱:syrup-queue,代碼行數:25,代碼來源:WorkerManager.php

示例2: reset

 private function reset()
 {
     if ($this->doctrine) {
         /** @var Connection $c */
         $c = $this->doctrine->getConnection();
         $c->close();
         $this->doctrine->resetManager();
     }
 }
開發者ID:mcfedr,項目名稱:queue-manager-bundle,代碼行數:9,代碼來源:DoctrineResetSubscriber.php

示例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');
 }
開發者ID:sanborino,項目名稱:clinica,代碼行數:7,代碼來源:RegistryTest.php


注:本文中的Doctrine\Bundle\DoctrineBundle\Registry::resetManager方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。