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


PHP ManagerRegistry::getManagers方法代碼示例

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


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

示例1: cleanUp

 public function cleanUp()
 {
     foreach ($this->managerRegistry->getManagers() as $name => $manager) {
         $this->logger->debug('Clear EntityManager', ['entity_manager' => $name]);
         $manager->clear();
     }
 }
開發者ID:cmodijk,項目名稱:LongRunning,代碼行數:7,代碼來源:ClearEntityManagers.php

示例2: warmUp

 /**
  * {@inheritdoc}
  */
 public function warmUp($cacheDir)
 {
     $helper = new UniqueNodeTypeHelper();
     foreach ($this->registry->getManagers() as $documentManager) {
         $helper->checkNodeTypeMappings($documentManager);
     }
 }
開發者ID:pamil,項目名稱:DoctrinePHPCRBundle,代碼行數:10,代碼來源:UniqueNodeTypeCacheWarmer.php

示例3: boot

 /**
  * Boot the extensions
  */
 public function boot()
 {
     foreach ($this->registry->getManagers() as $connection => $em) {
         foreach ($this->extensions as $extension) {
             if ($this->notBootedYet($connection, $extension)) {
                 $this->bootExtension($connection, $extension, $em, $em->getEventManager(), $em->getConfiguration());
             }
         }
     }
 }
開發者ID:Devitek,項目名稱:orm,代碼行數:13,代碼來源:ExtensionManager.php

示例4: boot

 /**
  * Boot the extensions
  */
 public function boot()
 {
     foreach ($this->registry->getManagers() as $em) {
         $this->em = $em;
         $this->evm = $this->em->getEventManager();
         $this->metadata = $this->em->getConfiguration();
         $this->reader = $this->driverChain->getReader();
         foreach ($this->extensions as $extension) {
             $this->bootExtension($extension);
         }
     }
 }
開發者ID:vyolla,項目名稱:orm,代碼行數:15,代碼來源:ExtensionManager.php

示例5: 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;
 }
開發者ID:behinddesign,項目名稱:swarrot,代碼行數:15,代碼來源:ObjectManagerProcessor.php

示例6: 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);
         }
     }
 }
開發者ID:cmodijk,項目名稱:LongRunning,代碼行數:12,代碼來源:ResetClosedEntityManagers.php

示例7: isKnownEntityClassNamespace

 /**
  * Checks whether the given namespace is registered in the Doctrine
  *
  * @param string $namespace
  * @return bool
  */
 public function isKnownEntityClassNamespace($namespace)
 {
     foreach (array_keys($this->doctrine->getManagers()) as $name) {
         $manager = $this->doctrine->getManager($name);
         if ($manager instanceof EntityManager) {
             $namespaces = $manager->getConfiguration()->getEntityNamespaces();
             if (in_array($namespace, $namespaces, true)) {
                 return true;
             }
         }
     }
     return false;
 }
開發者ID:xamin123,項目名稱:platform,代碼行數:19,代碼來源:EntityClassResolver.php

示例8: supports

 /**
  * {@inheritdoc}
  */
 function supports(ParamConverter $configuration)
 {
     if (null === $this->registry || !count($this->registry->getManagers())) {
         return false;
     }
     if (null === $configuration->getClass()) {
         return false;
     }
     $em = $this->registry->getManagerForClass($configuration->getClass());
     if ('SensorBundle\\Entity\\Measure' !== $em->getClassMetadata($configuration->getClass())->getName()) {
         return false;
     }
     return true;
 }
開發者ID:rybus,項目名稱:mogette-ui,代碼行數:17,代碼來源:SensorByPeriodConverter.php

示例9: boot

 /**
  * Boot the extensions
  */
 public function boot()
 {
     foreach ($this->registry->getManagers() as $em) {
         $this->em = $em;
         $this->evm = $this->em->getEventManager();
         $this->metadata = $this->em->getConfiguration();
         $this->reader = $this->driverChain->getReader();
         $hash = spl_object_hash($em);
         if (!isset($this->subscribedExtensions[$hash])) {
             $this->subscribedExtensions[$hash] = [];
         }
         foreach ($this->extensions as $extension) {
             $this->bootExtension($extension);
         }
     }
 }
開發者ID:jee7,項目名稱:orm,代碼行數:19,代碼來源:ExtensionManager.php

示例10: getMetadata

 protected function getMetadata($class)
 {
     if (array_key_exists($class, $this->cache)) {
         return $this->cache[$class];
     }
     $this->cache[$class] = null;
     foreach ($this->registry->getManagers() as $name => $em) {
         try {
             return $this->cache[$class] = array($em->getClassMetadata($class), $name);
         } catch (MappingException $e) {
             // not an entity or mapped super class
         } catch (LegacyMappingException $e) {
             // not an entity or mapped super class, using Doctrine ORM 2.2
         }
     }
 }
開發者ID:sgh1986915,項目名稱:symfony-tsk,代碼行數:16,代碼來源:EntityHiddenType.php

示例11: boot

 /**
  * Boot the extensions
  */
 public function boot()
 {
     foreach ($this->registry->getManagers() as $em) {
         $this->em = $em;
         $this->chain = new MappingDriverChain();
         $this->evm = $this->em->getEventManager();
         $this->metadata = $this->em->getConfiguration();
         $this->reader = method_exists($this->metadata->getMetadataDriverImpl(), 'getReader') ? $this->metadata->getMetadataDriverImpl()->getReader() : false;
         if ($this->gedmo['enabled']) {
             $this->bootGedmoExtensions($this->gedmo['namespace'], $this->gedmo['all']);
         }
         foreach ($this->extensions as $extenion) {
             $this->bootExtension($extenion);
         }
     }
 }
開發者ID:rosstuck,項目名稱:Laravel-Doctrine,代碼行數:19,代碼來源:ExtensionManager.php

示例12: fromRegistry

 /**
  * Create a driver from a Doctrine registry
  *
  * @param ManagerRegistry $registry
  * @return DriverInterface
  */
 public static function fromRegistry(ManagerRegistry $registry)
 {
     $drivers = array();
     foreach ($registry->getManagers() as $manager) {
         $drivers[] = self::fromManager($manager);
     }
     return new DriverChain($drivers);
 }
開發者ID:prezent,項目名稱:doctrine-translatable,代碼行數:14,代碼來源:DoctrineAdapter.php

示例13: write

 /**
  * {@inheritdoc}
  */
 public function write(array $items)
 {
     if (is_array(reset($items))) {
         $items = call_user_func_array('array_merge', $items);
     }
     foreach ($items as $item) {
         if (!is_object($item)) {
             throw new \InvalidArgumentException(sprintf('Expecting item of type object, got "%s"', gettype($item)));
         }
         $this->registry->getManagerForClass(get_class($item))->persist($item);
         $this->incrementCount($item);
     }
     foreach ($this->registry->getManagers() as $manager) {
         $manager->flush();
     }
     $this->cacheClearer->clear();
 }
開發者ID:jacko972,項目名稱:pim-community-dev,代碼行數:20,代碼來源:Writer.php

示例14: boot

 /**
  * Boot the service provider
  *
  * @param ManagerRegistry $registry
  */
 public function boot(ManagerRegistry $registry)
 {
     foreach ($registry->getManagers() as $manager) {
         $chain = $manager->getConfiguration()->getMetadataDriverImpl();
         $reader = $chain->getReader();
         if ($this->app->make('config')->get('doctrine.gedmo.all_mappings', false)) {
             DoctrineExtensions::registerMappingIntoDriverChainORM($chain, $reader);
         } else {
             DoctrineExtensions::registerAbstractMappingIntoDriverChainORM($chain, $reader);
         }
     }
 }
開發者ID:jee7,項目名稱:extensions,代碼行數:17,代碼來源:GedmoExtensionsServiceProvider.php

示例15: supports

 public function supports(ConfigurationInterface $configuration)
 {
     // if there is no manager, this means that only Doctrine DBAL is configured
     if (null === $this->registry || !count($this->registry->getManagers())) {
         return false;
     }
     if (null === $configuration->getClass()) {
         return false;
     }
     $options = $this->getOptions($configuration);
     // Doctrine Entity?
     return !$this->registry->getManager($options['entity_manager'])->getMetadataFactory()->isTransient($configuration->getClass());
 }
開發者ID:rrehbeindoi,項目名稱:SensioFrameworkExtraBundle,代碼行數:13,代碼來源:DoctrineParamConverter.php


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