当前位置: 首页>>代码示例>>PHP>>正文


PHP MongoDBException::reflectionFailure方法代码示例

本文整理汇总了PHP中Doctrine\ODM\MongoDB\MongoDBException::reflectionFailure方法的典型用法代码示例。如果您正苦于以下问题:PHP MongoDBException::reflectionFailure方法的具体用法?PHP MongoDBException::reflectionFailure怎么用?PHP MongoDBException::reflectionFailure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Doctrine\ODM\MongoDB\MongoDBException的用法示例。


在下文中一共展示了MongoDBException::reflectionFailure方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: loadMetadata

 /**
  * Loads the metadata of the class in question and all it's ancestors whose metadata
  * is still not loaded.
  *
  * @param string $name The name of the class for which the metadata should get loaded.
  * @param array  $tables The metadata collection to which the loaded metadata is added.
  */
 private function loadMetadata($className)
 {
     if (!$this->initialized) {
         $this->initialize();
     }
     $loaded = array();
     $parentClasses = $this->getParentClasses($className);
     $parentClasses[] = $className;
     // Move down the hierarchy of parent classes, starting from the topmost class
     $parent = null;
     $visited = array();
     foreach ($parentClasses as $className) {
         if (isset($this->loadedMetadata[$className])) {
             $parent = $this->loadedMetadata[$className];
             if (!$parent->isMappedSuperclass && !$parent->isEmbeddedDocument) {
                 array_unshift($visited, $className);
             }
             continue;
         }
         $class = $this->newClassMetadataInstance($className);
         if ($parent) {
             if (!$parent->isMappedSuperclass) {
                 $class->setInheritanceType($parent->inheritanceType);
                 $class->setDiscriminatorField($parent->discriminatorField);
                 $class->setDiscriminatorMap($parent->discriminatorMap);
             }
             $class->setIdGeneratorType($parent->generatorType);
             $this->addInheritedFields($class, $parent);
             $this->addInheritedIndexes($class, $parent);
             $class->setIdentifier($parent->identifier);
             $class->setVersioned($parent->isVersioned);
             $class->setVersionField($parent->versionField);
             $class->setLifecycleCallbacks($parent->lifecycleCallbacks);
             $class->setChangeTrackingPolicy($parent->changeTrackingPolicy);
             $class->setFile($parent->getFile());
         }
         // Invoke driver
         try {
             $this->driver->loadMetadataForClass($className, $class);
         } catch (\ReflectionException $e) {
             throw MongoDBException::reflectionFailure($className, $e);
         }
         $this->validateIdentifier($class);
         if ($parent && !$parent->isMappedSuperclass && !$class->isEmbeddedDocument) {
             if ($parent->generatorType) {
                 $class->setIdGeneratorType($parent->generatorType);
             }
             if ($parent->generatorOptions) {
                 $class->setIdGeneratorOptions($parent->generatorOptions);
             }
             if ($parent->idGenerator) {
                 $class->setIdGenerator($parent->idGenerator);
             }
         } else {
             $this->completeIdGeneratorMapping($class);
         }
         if ($parent && $parent->isInheritanceTypeSingleCollection()) {
             $class->setDatabase($parent->getDatabase());
             $class->setCollection($parent->getCollection());
         }
         $class->setParentClasses($visited);
         if ($this->evm->hasListeners(Events::loadClassMetadata)) {
             $eventArgs = new \Doctrine\ODM\MongoDB\Event\LoadClassMetadataEventArgs($class, $this->dm);
             $this->evm->dispatchEvent(Events::loadClassMetadata, $eventArgs);
         }
         $this->loadedMetadata[$className] = $class;
         $parent = $class;
         if (!$class->isMappedSuperclass && !$class->isEmbeddedDocument) {
             array_unshift($visited, $className);
         }
         $loaded[] = $className;
     }
     return $loaded;
 }
开发者ID:noikiy,项目名称:inovi,代码行数:81,代码来源:ClassMetadataFactory.php

示例2: loadMetadata

 /**
  * Loads the metadata of the class in question and all it's ancestors whose metadata
  * is still not loaded.
  *
  * @param string $name The name of the class for which the metadata should get loaded.
  * @param array  $tables The metadata collection to which the loaded metadata is added.
  */
 private function loadMetadata($className)
 {
     if (!$this->initialized) {
         $this->initialize();
     }
     $loaded = array();
     $parentClasses = $this->getParentClasses($className);
     $parentClasses[] = $className;
     // Move down the hierarchy of parent classes, starting from the topmost class
     $parent = null;
     $visited = array();
     foreach ($parentClasses as $className) {
         if (isset($this->loadedMetadata[$className])) {
             $parent = $this->loadedMetadata[$className];
             if (!$parent->isMappedSuperclass && !$parent->isEmbeddedDocument) {
                 array_unshift($visited, $className);
             }
             continue;
         }
         $class = $this->newClassMetadataInstance($className);
         if ($parent) {
             $class->setInheritanceType($parent->inheritanceType);
             $class->setDiscriminatorField($parent->discriminatorField);
             $this->addInheritedFields($class, $parent);
             $class->setIdentifier($parent->identifier);
             $class->setDiscriminatorMap($parent->discriminatorMap);
             $class->setLifecycleCallbacks($parent->lifecycleCallbacks);
             $class->setFile($parent->getFile());
         }
         // Invoke driver
         try {
             $this->driver->loadMetadataForClass($className, $class);
         } catch (ReflectionException $e) {
             throw MongoDBException::reflectionFailure($className, $e);
         }
         if (!$class->identifier && !$class->isMappedSuperclass && !$class->isEmbeddedDocument) {
             throw MongoDBException::identifierRequired($className);
         }
         if ($parent && $parent->isInheritanceTypeSingleCollection()) {
             $class->setDB($parent->getDB());
             $class->setCollection($parent->getCollection());
         }
         $db = $class->getDB() ?: $this->dm->getConfiguration()->getDefaultDB();
         $class->setDB($this->dm->formatDBName($db));
         $class->setParentClasses($visited);
         if ($this->evm->hasListeners(ODMEvents::loadClassMetadata)) {
             $eventArgs = new \Doctrine\ODM\MongoDB\Event\LoadClassMetadataEventArgs($class);
             $this->evm->dispatchEvent(ODMEvents::loadClassMetadata, $eventArgs);
         }
         $this->loadedMetadata[$className] = $class;
         $parent = $class;
         if (!$class->isMappedSuperclass && !$class->isEmbeddedDocument) {
             array_unshift($visited, $className);
         }
         $loaded[] = $className;
     }
     return $loaded;
 }
开发者ID:skoop,项目名称:symfony-sandbox,代码行数:65,代码来源:ClassMetadataFactory.php


注:本文中的Doctrine\ODM\MongoDB\MongoDBException::reflectionFailure方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。