本文整理汇总了PHP中Doctrine_Migration::getTableName方法的典型用法代码示例。如果您正苦于以下问题:PHP Doctrine_Migration::getTableName方法的具体用法?PHP Doctrine_Migration::getTableName怎么用?PHP Doctrine_Migration::getTableName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine_Migration
的用法示例。
在下文中一共展示了Doctrine_Migration::getTableName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateMigrationsFromModels
/**
* Generate a set of migrations from a set of models
*
* @param string $modelsPath Path to models
* @param string $modelLoading What type of model loading to use when loading the models
* @return boolean
*/
public function generateMigrationsFromModels($modelsPath = null, $modelLoading = null)
{
if ($modelsPath !== null) {
$models = Doctrine_Core::filterInvalidModels(Doctrine_Core::loadModels($modelsPath, $modelLoading));
} else {
$models = Doctrine_Core::getLoadedModels();
}
$models = Doctrine_Core::initializeModels($models);
$foreignKeys = array();
foreach ($models as $model) {
$table = Doctrine_Core::getTable($model);
if ($table->getTableName() !== $this->migration->getTableName()) {
$export = $table->getExportableFormat();
$foreignKeys[$export['tableName']] = $export['options']['foreignKeys'];
$up = $this->buildCreateTable($export);
$down = $this->buildDropTable($export);
$className = 'Add' . Doctrine_Inflector::classify($export['tableName']);
$this->generateMigrationClass($className, array(), $up, $down);
}
}
if ( ! empty($foreignKeys)) {
$className = 'AddFks';
$up = array();
$down = array();
foreach ($foreignKeys as $tableName => $definitions) {
$tableForeignKeyNames[$tableName] = array();
foreach ($definitions as $definition) {
$up[] = $this->buildCreateForeignKey($tableName, $definition);
$down[] = $this->buildDropForeignKey($tableName, $definition);
}
}
$up = implode("\n", $up);
$down = implode("\n", $down);
if ($up || $down) {
$this->generateMigrationClass($className, array(), $up, $down);
}
}
return true;
}