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


PHP Doctrine_Migration::getNextVersion方法代码示例

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


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

示例1: testMigration

 public function testMigration()
 {
     $migration = new Doctrine_Migration('migration_classes');
     $this->assertFalse($migration->hasMigrated());
     $migration->setCurrentVersion(3);
     $migration->migrate(0);
     $this->assertEqual($migration->getCurrentVersion(), 0);
     $this->assertEqual($migration->getLatestVersion(), 11);
     $this->assertEqual($migration->getNextVersion(), 12);
     $current = $migration->getCurrentVersion();
     $migration->setCurrentVersion(100);
     $this->assertEqual($migration->getCurrentVersion(), 100);
     $migration->setCurrentVersion($current);
     $migration->migrate(3);
     $this->assertTrue($migration->hasMigrated());
     $this->assertEqual($migration->getCurrentVersion(), 3);
     $this->assertTrue($this->conn->import->tableExists('migration_phonenumber'));
     $this->assertTrue($this->conn->import->tableExists('migration_user'));
     $this->assertTrue($this->conn->import->tableExists('migration_profile'));
     $migration->migrate(4);
     $this->assertFalse($this->conn->import->tableExists('migration_profile'));
     $migration->migrate(0);
     $this->assertEqual($migration->getCurrentVersion(), 0);
     $this->assertTrue($migration->getMigrationClass(1) instanceof AddPhonenumber);
     $this->assertTrue($migration->getMigrationClass(2) instanceof AddUser);
     $this->assertTrue($migration->getMigrationClass(3) instanceof AddProfile);
     $this->assertTrue($migration->getMigrationClass(4) instanceof DropProfile);
     $this->assertFalse($this->conn->import->tableExists('migration_phonenumber'));
     $this->assertFalse($this->conn->import->tableExists('migration_user'));
     $this->assertFalse($this->conn->import->tableExists('migration_profile'));
     $this->assertEqual(array(1 => 'AddPhonenumber', 2 => 'AddUser', 3 => 'AddProfile', 4 => 'DropProfile', 5 => 'Test5', 6 => 'Test6', 7 => 'Test7', 8 => 'Test8', 9 => 'Test9', 10 => 'Test10', 11 => 'Test11'), $migration->getMigrationClasses());
 }
开发者ID:dennybrandes,项目名称:doctrine1,代码行数:32,代码来源:MigrationTestCase.php

示例2: testMigration

 public function testMigration()
 {
     $migration = new Doctrine_Migration('migration_classes');
     $this->assertFalse($migration->hasMigrated());
     $migration->setCurrentVersion(3);
     $migration->migrate(0);
     $this->assertEqual($migration->getCurrentVersion(), 0);
     $this->assertEqual($migration->getLatestVersion(), 4);
     $this->assertEqual($migration->getNextVersion(), 5);
     $current = $migration->getCurrentVersion();
     $migration->setCurrentVersion(100);
     $this->assertEqual($migration->getCurrentVersion(), 100);
     $migration->setCurrentVersion($current);
     $migration->migrate(3);
     $this->assertTrue($migration->hasMigrated());
     $this->assertEqual($migration->getCurrentVersion(), 3);
     $this->assertTrue($this->conn->import->tableExists('migration_phonenumber'));
     $this->assertTrue($this->conn->import->tableExists('migration_user'));
     $this->assertTrue($this->conn->import->tableExists('migration_profile'));
     $migration->migrate(4);
     $this->assertFalse($this->conn->import->tableExists('migration_profile'));
     $migration->migrate(0);
     $this->assertEqual($migration->getCurrentVersion(), 0);
     $this->assertTrue($migration->getMigrationClass(1) instanceof AddPhonenumber);
     $this->assertTrue($migration->getMigrationClass(2) instanceof AddUser);
     $this->assertTrue($migration->getMigrationClass(3) instanceof AddProfile);
     $this->assertTrue($migration->getMigrationClass(4) instanceof DropProfile);
     $this->assertFalse($this->conn->import->tableExists('migration_phonenumber'));
     $this->assertFalse($this->conn->import->tableExists('migration_user'));
     $this->assertFalse($this->conn->import->tableExists('migration_profile'));
 }
开发者ID:skoop,项目名称:doctrine1,代码行数:31,代码来源:MigrationTestCase.php

示例3: generateMigrationClass

 /**
  * generateMigrationClass
  *
  * @return void
  */
 public function generateMigrationClass($className, $options = array(), $up = null, $down = null, $return = false)
 {
     if ($return || !$this->getMigrationsPath()) {
         return $this->buildMigrationClass($className, null, $options, $up, $down);
     } else {
         if (!$this->getMigrationsPath()) {
             throw new Doctrine_Migration_Exception('You must specify the path to your migrations.');
         }
         $migration = new Doctrine_Migration($this->getMigrationsPath());
         $next = (string) $migration->getNextVersion();
         $fileName = str_repeat('0', 3 - strlen($next)) . $next . '_' . Doctrine::tableize($className) . $this->suffix;
         $class = $this->buildMigrationClass($className, $fileName, $options, $up, $down);
         $path = $this->getMigrationsPath() . DIRECTORY_SEPARATOR . $fileName;
         file_put_contents($path, $class);
     }
 }
开发者ID:kirvin,项目名称:the-nerdery,代码行数:21,代码来源:Builder.php


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