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


PHP ObjectManager::getConfiguration方法代碼示例

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


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

示例1: setUp

 /**
  * Test setup
  */
 protected function setUp()
 {
     // setup entity aliases
     $this->em = DoctrineTestHelper::createTestEntityManager();
     $entityManagerNamespaces = $this->em->getConfiguration()->getEntityNamespaces();
     $entityManagerNamespaces['WebtownPhpBannerBundle'] = 'WebtownPhp\\BannerBundle\\Entity';
     $this->em->getConfiguration()->setEntityNamespaces($entityManagerNamespaces);
     // setup schema
     $schemaTool = new SchemaTool($this->em);
     $classes = [];
     foreach ($this->getEntities() as $entityClass) {
         $classes[] = $this->em->getClassMetadata($entityClass);
     }
     try {
         $schemaTool->dropSchema($classes);
     } catch (\Exception $e) {
     }
     try {
         $schemaTool->createSchema($classes);
     } catch (\Exception $e) {
     }
     $registry = \Mockery::mock('Doctrine\\Bundle\\DoctrineBundle\\Registry');
     $registry->shouldReceive('getManager')->andReturn($this->em);
     $this->bm = new ORMManager($registry, new EventDispatcher());
 }
開發者ID:webtown-php,項目名稱:BannerBundle,代碼行數:28,代碼來源:OMTestCase.php

示例2: __construct

 /**
  * Initializes extension driver
  *
  * @param ObjectManager $objectManager
  * @param string $extensionNamespace
  * @param object $annotationReader
  */
 public function __construct(ObjectManager $objectManager, $extensionNamespace, $annotationReader)
 {
     $this->objectManager = $objectManager;
     $this->annotationReader = $annotationReader;
     $this->extensionNamespace = $extensionNamespace;
     $omDriver = $objectManager->getConfiguration()->getMetadataDriverImpl();
     $this->driver = $this->getDriver($omDriver);
 }
開發者ID:pabloasc,項目名稱:test_social,代碼行數:15,代碼來源:ExtensionMetadataFactory.php

示例3: getSubClasses

 /**
  * @param string $class
  * @param ObjectManager $om
  * @return array
  */
 private function getSubClasses($class, ObjectManager $om)
 {
     $classes = [];
     foreach ($om->getConfiguration()->getMetadataDriverImpl()->getAllClassNames() as $className) {
         if (is_subclass_of($className, $class, true)) {
             $classes[] = $className;
         }
     }
     return $classes;
 }
開發者ID:coolms,項目名稱:doctrine,代碼行數:15,代碼來源:DiscriminatorEntrySubscriber.php

示例4: getEntityStatus

 /**
  * Returns information about which entities exist and possibly if their
  * mapping information contains errors or not.
  *
  * @return array
  */
 public function getEntityStatus()
 {
     $entityClassNames = $this->entityManager->getConfiguration()->getMetadataDriverImpl()->getAllClassNames();
     $info = array();
     foreach ($entityClassNames as $entityClassName) {
         try {
             $info[$entityClassName] = $this->entityManager->getClassMetadata($entityClassName);
         } catch (\Doctrine\ORM\Mapping\MappingException $e) {
             $info[$entityClassName] = $e->getMessage();
         }
     }
     return $info;
 }
開發者ID:patrickreck,項目名稱:flow-development-collection,代碼行數:19,代碼來源:Service.php

示例5: __construct

 /**
  * Initializes extension driver.
  *
  * @param \Doctrine\Common\Persistence\ObjectManager $objectManager
  * @param string $extensionNamespace
  * @param object $annotationReader
  */
 public function __construct(ObjectManager $objectManager, $extensionNamespace, $annotationReader)
 {
     $this->objectManager = $objectManager;
     $this->annotationReader = $annotationReader;
     $this->extensionNamespace = $extensionNamespace;
     $omDriver = $objectManager->getConfiguration()->getMetadataDriverImpl();
     $omCache = $this->objectManager->getMetadataFactory()->getCacheDriver();
     $metadataClassName = null;
     if (class_exists($this->extensionNamespace . '\\Mapping\\ClassMetadata')) {
         $metadataClassName = $this->extensionNamespace . '\\Mapping\\ClassMetadata';
     }
     $driver = $this->getDriver($omDriver);
     $driver->setBaseMetadataFactory($objectManager->getMetadataFactory());
     parent::__construct($driver, $omCache, $extensionNamespace, $metadataClassName);
 }
開發者ID:norzechowicz,項目名稱:doctrine-extensions,代碼行數:22,代碼來源:ExtendedMetadataFactory.php

示例6: getSql

 /**
  * @param DoctrineSqlFilter $sqlFilter
  * @param ClassMetadata $targetEntity
  * @param string $targetTableAlias
  * @return string
  * @throws InvalidQueryRewritingConstraintException
  * @throws \Exception
  */
 public function getSql(DoctrineSqlFilter $sqlFilter, ClassMetadata $targetEntity, $targetTableAlias)
 {
     $targetEntityPropertyName = strpos($this->path, '.') ? substr($this->path, 0, strpos($this->path, '.')) : $this->path;
     $quoteStrategy = $this->entityManager->getConfiguration()->getQuoteStrategy();
     if ($targetEntity->hasAssociation($targetEntityPropertyName) === FALSE) {
         return $this->getSqlForSimpleProperty($sqlFilter, $quoteStrategy, $targetEntity, $targetTableAlias, $targetEntityPropertyName);
     } elseif (strstr($this->path, '.') === FALSE && $targetEntity->isSingleValuedAssociation($targetEntityPropertyName) === TRUE && $targetEntity->isAssociationInverseSide($targetEntityPropertyName) === FALSE) {
         return $this->getSqlForManyToOneAndOneToOneRelationsWithoutPropertyPath($sqlFilter, $quoteStrategy, $targetEntity, $targetTableAlias, $targetEntityPropertyName);
     } elseif ($targetEntity->isSingleValuedAssociation($targetEntityPropertyName) === TRUE && $targetEntity->isAssociationInverseSide($targetEntityPropertyName) === FALSE) {
         return $this->getSqlForManyToOneAndOneToOneRelationsWithPropertyPath($sqlFilter, $quoteStrategy, $targetEntity, $targetTableAlias, $targetEntityPropertyName);
     } elseif ($targetEntity->isSingleValuedAssociation($targetEntityPropertyName) === TRUE && $targetEntity->isAssociationInverseSide($targetEntityPropertyName) === TRUE) {
         throw new InvalidQueryRewritingConstraintException('Single valued properties from the inverse side are not supported in a content security constraint path! Got: "' . $this->path . ' ' . $this->operator . ' ' . $this->operandDefinition . '"', 1416397754);
     } elseif ($targetEntity->isCollectionValuedAssociation($targetEntityPropertyName) === TRUE) {
         throw new InvalidQueryRewritingConstraintException('Multivalued properties are not supported in a content security constraint path! Got: "' . $this->path . ' ' . $this->operator . ' ' . $this->operandDefinition . '"', 1416397655);
     }
     throw new InvalidQueryRewritingConstraintException('The configured operator of the entity constraint is not valid/supported. Got: ' . $this->operator, 1270483540);
 }
開發者ID:nlx-sascha,項目名稱:flow-development-collection,代碼行數:25,代碼來源:PropertyConditionGenerator.php

示例7: driversFromManager

 /**
  * Create a driver from a Doctrine object manager.
  *
  * @param ObjectManager $om
  *
  * @return DriverInterface
  */
 public static function driversFromManager(ObjectManager $om)
 {
     return self::driversFromMetadataDriver($om->getConfiguration()->getMetadataDriverImpl());
 }
開發者ID:cubiche,項目名稱:cubiche,代碼行數:11,代碼來源:DriverFactory.php


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