当前位置: 首页>>代码示例>>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;未经允许,请勿转载。