當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。