本文整理汇总了PHP中Doctrine::generateMigrationsFromDb方法的典型用法代码示例。如果您正苦于以下问题:PHP Doctrine::generateMigrationsFromDb方法的具体用法?PHP Doctrine::generateMigrationsFromDb怎么用?PHP Doctrine::generateMigrationsFromDb使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine
的用法示例。
在下文中一共展示了Doctrine::generateMigrationsFromDb方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute()
{
try {
$migrationsPath = $this->getArgument('migrations_path');
$yamlSchemaPath = $this->getArgument('yaml_schema_path');
$migration = new Doctrine_Migration($migrationsPath);
$result1 = false;
if (!count($migration->getMigrationClasses())) {
$result1 = Doctrine::generateMigrationsFromDb($migrationsPath);
}
$connections = array();
foreach (Doctrine_Manager::getInstance() as $connection) {
$connections[] = $connection->getName();
}
$changes = Doctrine::generateMigrationsFromDiff($migrationsPath, $connections, $yamlSchemaPath);
$numChanges = count($changes, true) - count($changes);
$result = $result1 || $numChanges ? true : false;
} catch (Exception $e) {
$result = false;
}
if (!$result) {
throw new Doctrine_Task_Exception('Could not generate migration classes from database');
} else {
$this->notify('Generated migration classes successfully from database');
}
}
示例2: execute
public function execute()
{
Doctrine::generateMigrationsFromDb($this->getArgument('migrations_path'));
$this->notify('Generated migration classes successfully from database');
}