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


PHP SchemaTool::dropDatabase方法代码示例

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


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

示例1: tearDown

 protected function tearDown()
 {
     // Clean anything still idle in the UOW
     $this->_em->clear();
     // Clear out anything set in the db (schema is recreated on setUp()
     $this->_schemaTool->dropDatabase();
 }
开发者ID:jdrich,项目名称:drest,代码行数:7,代码来源:DrestFunctionalTestCase.php

示例2: rebuildDatabase

 /**
  * Builds the DB Schema
  *
  * @return void
  */
 protected function rebuildDatabase()
 {
     # 2. Drop the existing database schema
     $this->schemaTool->dropDatabase();
     # 3. Create the new database schema based on (1)
     $entityMeta = $this->em->getMetadataFactory()->getAllMetadata();
     $this->schemaTool->updateSchema($entityMeta);
 }
开发者ID:jtallant,项目名称:skimpy-engine,代码行数:13,代码来源:Populator.php

示例3: tearDown

 protected function tearDown()
 {
     parent::tearDown();
     $tool = new SchemaTool($this->em);
     $tool->dropDatabase();
     unset($this->em);
 }
开发者ID:dotuancd,项目名称:secretary,代码行数:7,代码来源:AuthController.php

示例4: executeSchemaCommand

 protected function executeSchemaCommand(InputInterface $input, OutputInterface $output, SchemaTool $schemaTool, array $metadatas)
 {
     $isFullDatabaseDrop = $input->getOption('full-database');
     if ($input->getOption('dump-sql') === true) {
         if ($isFullDatabaseDrop) {
             $sqls = $schemaTool->getDropDatabaseSQL();
         } else {
             $sqls = $schemaTool->getDropSchemaSQL($metadatas);
         }
         $output->write(implode(';' . PHP_EOL, $sqls) . PHP_EOL);
     } else {
         if ($input->getOption('force') === true) {
             $output->write('Dropping database schema...' . PHP_EOL);
             if ($isFullDatabaseDrop) {
                 $schemaTool->dropDatabase();
             } else {
                 $schemaTool->dropSchema($metadatas);
             }
             $output->write('Database schema dropped successfully!' . PHP_EOL);
         } else {
             $output->write('ATTENTION: This operation should not be executed in a production environment.' . PHP_EOL . PHP_EOL);
             if ($isFullDatabaseDrop) {
                 $sqls = $schemaTool->getDropDatabaseSQL();
             } else {
                 $sqls = $schemaTool->getDropSchemaSQL($metadatas);
             }
             if (count($sqls)) {
                 $output->write('Schema-Tool would execute ' . count($sqls) . ' queries to drop the database.' . PHP_EOL);
                 $output->write('Please run the operation with --force to execute these queries or use --dump-sql to see them.' . PHP_EOL);
             } else {
                 $output->write('Nothing to drop. The database is empty!' . PHP_EOL);
             }
         }
     }
 }
开发者ID:krishcdbry,项目名称:z-zangura,代码行数:35,代码来源:DropCommand.php

示例5: loadFixtures

 protected function loadFixtures($client)
 {
     $container = $this->getContainer($client);
     $registry = $container->get('doctrine');
     if ($registry instanceof ManagerRegistry) {
         $om = $registry->getManager();
     } else {
         $om = $registry->getEntityManager();
     }
     $cacheDriver = $om->getMetadataFactory()->getCacheDriver();
     if ($cacheDriver) {
         $cacheDriver->deleteAll();
     }
     $connection = $om->getConnection();
     $params = $connection->getParams();
     $name = isset($params['path']) ? $params['path'] : (isset($params['dbname']) ? $params['dbname'] : false);
     if (!$name) {
         throw new \InvalidArgumentException("Connection does not contain a 'path' or 'dbname' parameter and cannot be dropped.");
     }
     $metadatas = $om->getMetadataFactory()->getAllMetadata();
     $schemaTool = new SchemaTool($om);
     $schemaTool->dropDatabase($name);
     if (!empty($metadatas)) {
         $schemaTool->createSchema($metadatas);
     }
 }
开发者ID:jbouhier,项目名称:2SN,代码行数:26,代码来源:WebTestCase.php

示例6: dropSchema

 /**
  * {@inheritDoc}
  */
 public function dropSchema()
 {
     $this->foreachObjectManagers(function (ObjectManager $objectManager) {
         $schemaTool = new DoctrineSchemaTool($objectManager);
         $schemaTool->dropDatabase();
     });
 }
开发者ID:claudio-dalicandro,项目名称:AliceFixturesBundle,代码行数:10,代码来源:DoctrineORMSchemaTool.php

示例7: createSchemaTool

 /**
  * @param EntityManager $em
  * @return SchemaTool
  */
 private function createSchemaTool(EntityManager $em)
 {
     $schemaTool = new SchemaTool($em);
     $schemaTool->dropDatabase();
     $schemaTool->createSchema($em->getMetadataFactory()->getAllMetadata());
     return $schemaTool;
 }
开发者ID:cobase,项目名称:cobase,代码行数:11,代码来源:ServiceTestCase.php

示例8: preTestSetUp

 public function preTestSetUp(EntityManagerEventArgs $eventArgs)
 {
     $em = $eventArgs->getEntityManager();
     $classes = array($em->getClassMetadata(__NAMESPACE__ . '\\Date'));
     $schemaTool = new SchemaTool($em);
     $schemaTool->dropDatabase();
     $schemaTool->createSchema($classes);
 }
开发者ID:Credit-Jeeves,项目名称:DoctrineExtensions,代码行数:8,代码来源:ZendDateTest.php

示例9: testSchemaDown

 public function testSchemaDown()
 {
     $schemaTool = new SchemaTool($this->entityManager);
     $schemaTool->dropDatabase();
     $schemaManager = $this->entityManager->getConnection()->getSchemaManager();
     $tables = $schemaManager->listTableNames();
     $this->assertEmpty($tables);
 }
开发者ID:Hikariii,项目名称:doctrine-extensions,代码行数:8,代码来源:TearDownTest.php

示例10: setUp

 public function setUp()
 {
     parent::setUp();
     $em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
     $schemaTool = new SchemaTool($em);
     $schemaTool->dropDatabase();
     $schemaTool->createSchema($em->getMetadataFactory()->getAllMetadata());
 }
开发者ID:bitecodes,项目名称:rest-api-generator-bundle,代码行数:8,代码来源:RestApiControllerWithSubResourcesTest.php

示例11: dropDatabases

 /**
  * Drops all databases
  *
  * @return void
  */
 public function dropDatabases()
 {
     /** @var EntityManagerInterface[] $managers */
     $managers = $this->get('doctrine')->getManagers();
     foreach ($managers as $manager) {
         $tool = new SchemaTool($manager);
         $tool->dropDatabase();
     }
 }
开发者ID:treehouselabs,项目名称:base-api-bundle,代码行数:14,代码来源:BaseFeatureContext.php

示例12: preTestSetUp

 public function preTestSetUp(EntityManagerEventArgs $eventArgs)
 {
     $em = $eventArgs->getEntityManager();
     $schemaTool = new SchemaTool($em);
     $cmf = $em->getMetadataFactory();
     $classes = $cmf->getAllMetadata();
     $schemaTool->dropDatabase();
     $schemaTool->createSchema($classes);
 }
开发者ID:lakhman,项目名称:TbbcMoneyBundle,代码行数:9,代码来源:SchemaSetupListener.php

示例13: initializeInMemoryDB

 protected function initializeInMemoryDB()
 {
     $entityManager = $this->getEntityManager();
     // try a real schema creation with the in memory sqlite driver
     $classes = $entityManager->getMetadataFactory()->getAllMetadata();
     $schemaTool = new SchemaTool($entityManager);
     $schemaTool->dropDatabase();
     $schemaTool->createSchema($classes);
 }
开发者ID:stefanotorresi,项目名称:thorr-oauth2-doctrine,代码行数:9,代码来源:IntegrationTestCase.php

示例14: setUp

 public function setUp()
 {
     self::$kernel = $this->createKernel(array('environment' => 'test'));
     self::$kernel->boot();
     $this->container = self::$kernel->getContainer();
     $em = $this->container->get('doctrine')->getEntityManager();
     $metadatas = $em->getMetadataFactory()->getAllMetadata();
     $schemaTool = new SchemaTool($em);
     $schemaTool->dropDatabase();
     $schemaTool->createSchema($metadatas);
 }
开发者ID:ninethousand,项目名称:NineThousandJobqueueBundle,代码行数:11,代码来源:StandardHistoryTest.php

示例15: setupDatabase

 private function setupDatabase()
 {
     $params = SqliteConfig::getParams();
     $entityManager = EntityManagerFactory::create($params);
     $tmpConnection = DriverManager::getConnection($params);
     $tmpConnection->getSchemaManager()->createDatabase($params['path']);
     $schemaTool = new SchemaTool($entityManager);
     $schemaTool->dropDatabase();
     $metadata = $entityManager->getMetadataFactory()->getAllMetadata();
     $schemaTool->createSchema($metadata);
 }
开发者ID:lzakrzewski,项目名称:tests-with-database-examples,代码行数:11,代码来源:SetupSqliteDatabaseCommand.php


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