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


PHP EntityManager::getMetaDataFactory方法代碼示例

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


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

示例1: setUp

 protected function setUp()
 {
     $this->em = $this->getEntityManager();
     $schemaTool = new SchemaTool($this->em);
     $classes = $this->em->getMetaDataFactory()->getAllMetadata();
     $schemaTool->dropSchema($classes);
     $schemaTool->createSchema($classes);
 }
開發者ID:erheme318,項目名稱:simple-tv-listings,代碼行數:8,代碼來源:DoctrineEntityManagerTest.php

示例2: setupTestSchema

 private function setupTestSchema()
 {
     $this->entityManager->clear();
     $classes = $this->entityManager->getMetaDataFactory()->getAllMetaData();
     $tool = new Doctrine\ORM\Tools\SchemaTool($this->entityManager);
     // $tool->dropSchema($classes);
     $tool->createSchema($classes);
 }
開發者ID:pdt256,項目名稱:truecar,代碼行數:8,代碼來源:DoctrineTestCase.php

示例3: setupTestSchema

 private function setupTestSchema()
 {
     if ($this->metaDataClassNames === null) {
         $classes = $this->entityManager->getMetaDataFactory()->getAllMetaData();
     } else {
         $classes = [];
         foreach ($this->metaDataClassNames as $className) {
             $classes[] = $this->entityManager->getMetaDataFactory()->getMetadataFor($className);
         }
     }
     $tool = new SchemaTool($this->entityManager);
     $tool->createSchema($classes);
 }
開發者ID:pdt256,項目名稱:article,代碼行數:13,代碼來源:RepositoryTestCase.php

示例4: setupTestSchema

 private function setupTestSchema()
 {
     $this->entityManager->clear();
     if (empty($this->metaDataClassNames)) {
         $classes = $this->entityManager->getMetaDataFactory()->getAllMetaData();
     } else {
         $classes = [];
         foreach ($this->metaDataClassNames as $className) {
             $classes[] = $this->entityManager->getMetaDataFactory()->getMetadataFor($className);
         }
     }
     $tool = new Doctrine\ORM\Tools\SchemaTool($this->entityManager);
     // $tool->dropSchema($classes);
     $tool->createSchema($classes);
 }
開發者ID:pdt256,項目名稱:vbscraper,代碼行數:15,代碼來源:DoctrineTestCase.php

示例5: create

 /**
  * Get database connection.
  *
  * @static
  *
  * @return DatabaseConnection
  */
 public static function create($mappingPath)
 {
     self::$_config = array('dbname' => $GLOBALS['db_name'], 'driver' => 'pdo_mysql', 'host' => $GLOBALS['db_host'], 'user' => $GLOBALS['db_user'], 'password' => $GLOBALS['db_password'], 'charset' => 'UTF8');
     self::createDatabase(self::$_config);
     /** @var \Doctrine\ORM\Configuration */
     $metadataConfiguration = Setup::createAnnotationMetadataConfiguration(array($mappingPath), true, null, null, false);
     self::$_em = EntityManager::create(self::$_config, $metadataConfiguration);
     $pdo = self::$_em->getConnection()->getWrappedConnection();
     self::$_em->clear();
     $tool = new SchemaTool(self::$_em);
     $classes = self::$_em->getMetaDataFactory()->getAllMetaData();
     $tool->dropSchema($classes);
     $tool->createSchema($classes);
     return new self();
 }
開發者ID:chalasr,項目名稱:doctrine-test-util,代碼行數:22,代碼來源:DatabaseConnection.php

示例6: getConnection

 public function getConnection()
 {
     $this->em = EntityManagerFactory::createEntityManager(__DIR__ . '/../../../../app/config/parameters_test.yml', __DIR__ . '/../../../../src', false);
     // Retrieve PDO instance
     $pdo = $this->em->getConnection()->getWrappedConnection();
     // Clear Doctrine to be safe
     $this->em->clear();
     // Schema Tool to process our entities
     $tool = new SchemaTool($this->em);
     $classes = $this->em->getMetaDataFactory()->getAllMetaData();
     // Drop all classes and re-build them for each test case
     $tool->dropSchema($classes);
     $tool->createSchema($classes);
     // Pass to PHPUnit
     return $this->createDefaultDBConnection($pdo, 'angular_cms_test');
 }
開發者ID:rmatil,項目名稱:angular-cms,代碼行數:16,代碼來源:ADatabaseTestCase.php

示例7: __construct

 /**
  *
  */
 public function __construct(EntityManager $entity_manager)
 {
     $metadata_factory = $entity_manager->getMetaDataFactory();
     foreach ($metadata_factory->getAllMetaData() as $class => $metadata) {
         if ($metadata->customRepositoryClassName == get_class($this)) {
             $this->model = $metadata->getName();
         }
     }
     parent::__construct($entity_manager, $entity_manager->getclassMetaData($this->model));
 }
開發者ID:dotink,項目名稱:inkwell-doctrine,代碼行數:13,代碼來源:Repository.php

示例8: createDatabase

 public static function createDatabase(EntityManager $em)
 {
     // Clear Doctrine to be safe
     $em->clear();
     // Schema Tool to process our entities
     $tool = new SchemaTool($em);
     $classes = $em->getMetaDataFactory()->getAllMetaData();
     // Drop all classes and re-build them for each test case
     $tool->dropSchema($classes);
     $tool->createSchema($classes);
 }
開發者ID:bonesmccoy,項目名稱:symfex,代碼行數:11,代碼來源:KernelTestCase.php

示例9: setUp

 protected function setUp()
 {
     if (!class_exists('\\Doctrine\\ORM\\Configuration')) {
         static::markTestSkipped('Doctrine is not available');
     }
     $config = new Configuration();
     $config->setMetadataCacheImpl(new ArrayCache());
     $config->setQueryCacheImpl(new ArrayCache());
     $config->setProxyDir(__DIR__ . '/Proxies');
     $config->setProxyNamespace('Boldtrn\\JsonbBundle\\Tests\\Proxies');
     $config->setAutoGenerateProxyClasses(true);
     $config->setMetadataDriverImpl($config->newDefaultAnnotationDriver(__DIR__ . '/Entities'));
     $config->addEntityNamespace('E', 'Boldtrn\\JsonbBundle\\Tests\\Entities');
     $config->setCustomStringFunctions(array('JSONB_AG' => 'Boldtrn\\JsonbBundle\\Query\\JsonbAtGreater', 'JSONB_HGG' => 'Boldtrn\\JsonbBundle\\Query\\JsonbHashGreaterGreater', 'JSONB_EX' => 'Boldtrn\\JsonbBundle\\Query\\JsonbExistence'));
     $this->entityManager = EntityManager::create($this->dbParams, $config);
     $this->connection = $this->entityManager->getConnection();
     $this->setUpDBALTypes();
     $tool = new SchemaTool($this->entityManager);
     $classes = $this->entityManager->getMetaDataFactory()->getAllMetaData();
     // Drop all classes and re-build them for each test case
     $tool->dropSchema($classes);
     $tool->createSchema($classes);
 }
開發者ID:adrienbrault,項目名稱:JsonbBundle,代碼行數:23,代碼來源:BaseTest.php

示例10: getEntityManager

 /**
  * @return EntityManager|object
  * @throws \Doctrine\ORM\Tools\ToolsException
  */
 public function getEntityManager()
 {
     if (!self::$entityManager instanceof EntityManager) {
         $kernel = static::createKernel();
         $kernel->boot();
         self::$entityManager = $kernel->getContainer()->get('doctrine.orm.entity_manager');
         // Clear Doctrine to be safe
         self::$entityManager->clear();
         // Schema Tool to process our entities
         $tool = new SchemaTool(self::$entityManager);
         $classes = self::$entityManager->getMetaDataFactory()->getAllMetaData();
         // Drop all classes and re-build them for each test case
         $tool->dropSchema($classes);
         $tool->createSchema($classes);
         //create our api user on first run
         $this->getUser();
     }
     return self::$entityManager;
 }
開發者ID:TransformCore,項目名稱:HayPersistenceApi,代碼行數:23,代碼來源:RepositoryTestCase.php

示例11: dropSchema

 public function dropSchema()
 {
     $classes = $this->entityManager->getMetaDataFactory()->getAllMetaData();
     $this->schemaTool->dropSchema($classes);
 }
開發者ID:pdt256,項目名稱:vbscraper,代碼行數:5,代碼來源:DoctrineHelper.php


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