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


PHP ObjectManager::isOpen方法代碼示例

本文整理匯總了PHP中Doctrine\Common\Persistence\ObjectManager::isOpen方法的典型用法代碼示例。如果您正苦於以下問題:PHP ObjectManager::isOpen方法的具體用法?PHP ObjectManager::isOpen怎麽用?PHP ObjectManager::isOpen使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Doctrine\Common\Persistence\ObjectManager的用法示例。


在下文中一共展示了ObjectManager::isOpen方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: persistAll

 /**
  * Commits new objects and changes to objects in the current persistence
  * session into the backend
  *
  * @param boolean $onlyWhitelistedObjects If TRUE an exception will be thrown if there are scheduled updates/deletes or insertions for objects that are not "whitelisted" (see AbstractPersistenceManager::whitelistObject())
  * @return void
  * @api
  */
 public function persistAll($onlyWhitelistedObjects = false)
 {
     if ($onlyWhitelistedObjects) {
         $unitOfWork = $this->entityManager->getUnitOfWork();
         /** @var \Doctrine\ORM\UnitOfWork $unitOfWork */
         $unitOfWork->computeChangeSets();
         $objectsToBePersisted = $unitOfWork->getScheduledEntityUpdates() + $unitOfWork->getScheduledEntityDeletions() + $unitOfWork->getScheduledEntityInsertions();
         foreach ($objectsToBePersisted as $object) {
             $this->throwExceptionIfObjectIsNotWhitelisted($object);
         }
     }
     if (!$this->entityManager->isOpen()) {
         $this->systemLogger->log('persistAll() skipped flushing data, the Doctrine EntityManager is closed. Check the logs for error message.', LOG_ERR);
         return;
     }
     try {
         $this->entityManager->flush();
     } catch (Exception $exception) {
         $this->systemLogger->logException($exception);
         /** @var Connection $connection */
         $connection = $this->entityManager->getConnection();
         $connection->close();
         $connection->connect();
         $this->systemLogger->log('Reconnected the Doctrine EntityManager to the persistence backend.', LOG_INFO);
         $this->entityManager->flush();
     } finally {
         $this->emitAllObjectsPersisted();
     }
 }
開發者ID:neos,項目名稱:flow-development-collection,代碼行數:37,代碼來源:PersistenceManager.php

示例2: persistAll

 /**
  * Commits new objects and changes to objects in the current persistence
  * session into the backend
  *
  * @return void
  * @api
  */
 public function persistAll()
 {
     if ($this->entityManager->isOpen()) {
         $this->entityManager->flush();
         $this->emitAllObjectsPersisted();
     } else {
         $this->systemLogger->log('persistAll() skipped flushing data, the Doctrine EntityManager is closed. Check the logs for error message.', LOG_ERR);
     }
 }
開發者ID:nxpthx,項目名稱:FLOW3,代碼行數:16,代碼來源:PersistenceManager.php

示例3: getObjectManager

 /**
  * Return a Doctrine ObjectManager
  *
  * @return ObjectManager
  */
 public function getObjectManager()
 {
     // Check if Object Manager is open
     // If it's closed, usually this means there has been an error
     if ($this->objectManager === null || method_exists($this->objectManager, 'isOpen') && !$this->objectManager->isOpen()) {
         // We want to recover and create a new instance of the Document manager
         $this->setObjectManager($this->getObjectManagerFromFactory());
         // But we should also create an error in the log
         // @TODO Log Object Manager was closed error
     }
     return $this->objectManager;
 }
開發者ID:parrotcage,項目名稱:birdbrain,代碼行數:17,代碼來源:AbstractService.php

示例4: persistAll

 /**
  * Commits new objects and changes to objects in the current persistence
  * session into the backend
  *
  * @param boolean $onlyWhitelistedObjects
  * @return void
  * @api
  */
 public function persistAll($onlyWhitelistedObjects = FALSE)
 {
     if ($onlyWhitelistedObjects) {
         $unitOfWork = $this->entityManager->getUnitOfWork();
         /** @var \Doctrine\ORM\UnitOfWork $unitOfWork */
         $objectsToBePersisted = $unitOfWork->getScheduledEntityUpdates() + $unitOfWork->getScheduledEntityDeletions() + $unitOfWork->getScheduledEntityInsertions();
         foreach ($objectsToBePersisted as $object) {
             $this->throwExceptionIfObjectIsNotWhitelisted($object);
         }
     }
     if ($this->entityManager->isOpen()) {
         $this->entityManager->flush();
         $this->emitAllObjectsPersisted();
     } else {
         $this->systemLogger->log('persistAll() skipped flushing data, the Doctrine EntityManager is closed. Check the logs for error message.', LOG_ERR);
     }
 }
開發者ID:animaltool,項目名稱:webinterface,代碼行數:25,代碼來源:PersistenceManager.php


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