1
0
mirror of synced 2024-12-13 14:56:01 +03:00

Formatting fixes.

This commit is contained in:
jwage 2008-01-23 00:43:03 +00:00
parent ee3bf044a6
commit 64ead091aa

View File

@ -66,9 +66,9 @@ class Doctrine_Migration
if ($directory != null) { if ($directory != null) {
$this->_migrationClassesDirectory = $directory; $this->_migrationClassesDirectory = $directory;
$this->loadMigrationClasses(); $this->_loadMigrationClasses();
$this->createMigrationTable(); $this->_createMigrationTable();
} }
} }
@ -101,7 +101,7 @@ class Doctrine_Migration
* *
* @return void * @return void
*/ */
protected function createMigrationTable() protected function _createMigrationTable()
{ {
$conn = Doctrine_Manager::connection(); $conn = Doctrine_Manager::connection();
@ -114,7 +114,6 @@ class Doctrine_Migration
} }
} }
/** /**
* loadMigrationClassesFromDirectory * loadMigrationClassesFromDirectory
* *
@ -152,7 +151,7 @@ class Doctrine_Migration
* *
* @return void * @return void
*/ */
protected function loadMigrationClasses() protected function _loadMigrationClasses()
{ {
if ($this->_migrationClasses) { if ($this->_migrationClasses) {
return $this->_migrationClasses; return $this->_migrationClasses;
@ -161,17 +160,15 @@ class Doctrine_Migration
$classes = get_declared_classes(); $classes = get_declared_classes();
if ($this->_migrationClassesDirectory !== null) { if ($this->_migrationClassesDirectory !== null) {
$this->loadMigrationClassesFromDirectory($classes); $this->_loadMigrationClassesFromDirectory($classes);
} }
$parent = new ReflectionClass('Doctrine_Migration'); $parent = new ReflectionClass('Doctrine_Migration');
foreach ($this->_loadedMigrations as $name => $fileName) { foreach ($this->_loadedMigrations as $name => $fileName) {
$class = new ReflectionClass($name); $class = new ReflectionClass($name);
while ($class->isSubclassOf($parent)) { while ($class->isSubclassOf($parent)) {
$class = $class->getParentClass(); $class = $class->getParentClass();
if ($class === false) { if ($class === false) {
break; break;
@ -209,7 +206,7 @@ class Doctrine_Migration
* @param string $number * @param string $number
* @return void * @return void
*/ */
protected function setCurrentVersion($number) protected function _setCurrentVersion($number)
{ {
$conn = Doctrine_Manager::connection(); $conn = Doctrine_Manager::connection();
@ -261,7 +258,7 @@ class Doctrine_Migration
*/ */
public function getLatestVersion() public function getLatestVersion()
{ {
$this->loadMigrationClasses(); $this->_loadMigrationClasses();
$versions = array(); $versions = array();
foreach (array_keys($this->_migrationClasses) as $classMigrationNum) { foreach (array_keys($this->_migrationClasses) as $classMigrationNum) {
@ -291,7 +288,7 @@ class Doctrine_Migration
* @param string $num * @param string $num
* @return void * @return void
*/ */
protected function getMigrationClass($num) protected function _getMigrationClass($num)
{ {
foreach ($this->_migrationClasses as $classMigrationNum => $info) { foreach ($this->_migrationClasses as $classMigrationNum => $info) {
$className = $info['className']; $className = $info['className'];
@ -313,11 +310,11 @@ class Doctrine_Migration
* @param string $num * @param string $num
* @return void * @return void
*/ */
protected function doMigrateStep($direction, $num) protected function _doMigrateStep($direction, $num)
{ {
$migrate = $this->getMigrationClass($num); $migrate = $this->_getMigrationClass($num);
$migrate->doMigrate($direction); $migrate->_doMigrate($direction);
} }
/** /**
@ -328,11 +325,12 @@ class Doctrine_Migration
* @param string $direction * @param string $direction
* @return void * @return void
*/ */
protected function doMigrate($direction) protected function _doMigrate($direction)
{ {
if (! method_exists($this, $direction)) { if ( ! method_exists($this, $direction)) {
return; return;
} }
$this->$direction(); $this->$direction();
foreach ($this->_changes as $type => $changes) { foreach ($this->_changes as $type => $changes) {
@ -372,15 +370,15 @@ class Doctrine_Migration
if ($direction === 'up') { if ($direction === 'up') {
for ($i = $from + 1; $i <= $to; $i++) { for ($i = $from + 1; $i <= $to; $i++) {
$this->doMigrateStep($direction, $i); $this->_doMigrateStep($direction, $i);
} }
} else { } else {
for ($i = $from; $i > $to; $i--) { for ($i = $from; $i > $to; $i--) {
$this->doMigrateStep($direction, $i); $this->_doMigrateStep($direction, $i);
} }
} }
$this->setCurrentVersion($to); $this->_setCurrentVersion($to);
return $to; return $to;
} }
@ -392,7 +390,7 @@ class Doctrine_Migration
* @param string $array * @param string $array
* @return void * @return void
*/ */
protected function addChange($type, array $change = array()) protected function _addChange($type, array $change = array())
{ {
$this->_changes[$type][] = $change; $this->_changes[$type][] = $change;
} }
@ -409,7 +407,7 @@ class Doctrine_Migration
{ {
$options = get_defined_vars(); $options = get_defined_vars();
$this->addChange('created_tables', $options); $this->_addChange('created_tables', $options);
} }
/** /**
@ -422,7 +420,7 @@ class Doctrine_Migration
{ {
$options = get_defined_vars(); $options = get_defined_vars();
$this->addChange('dropped_tables', $options); $this->_addChange('dropped_tables', $options);
} }
/** /**
@ -436,7 +434,7 @@ class Doctrine_Migration
{ {
$options = get_defined_vars(); $options = get_defined_vars();
$this->addChange('renamed_tables', $options); $this->_addChange('renamed_tables', $options);
} }
/** /**
@ -450,7 +448,7 @@ class Doctrine_Migration
{ {
$options = get_defined_vars(); $options = get_defined_vars();
$this->addChange('created_constraints', $options); $this->_addChange('created_constraints', $options);
} }
/** /**
@ -464,7 +462,7 @@ class Doctrine_Migration
{ {
$options = get_defined_vars(); $options = get_defined_vars();
$this->addChange('dropped_constraints', $options); $this->_addChange('dropped_constraints', $options);
} }
/** /**
@ -478,7 +476,7 @@ class Doctrine_Migration
{ {
$options = get_defined_vars(); $options = get_defined_vars();
$this->addChange('created_fks', $options); $this->_addChange('created_fks', $options);
} }
/** /**
@ -492,7 +490,7 @@ class Doctrine_Migration
{ {
$options = get_defined_vars(); $options = get_defined_vars();
$this->addChange('dropped_fks', $options); $this->_addChange('dropped_fks', $options);
} }
/** /**
@ -508,7 +506,7 @@ class Doctrine_Migration
{ {
$options = get_defined_vars(); $options = get_defined_vars();
$this->addChange('added_columns', $options); $this->_addChange('added_columns', $options);
} }
/** /**
@ -523,7 +521,7 @@ class Doctrine_Migration
{ {
$options = get_defined_vars(); $options = get_defined_vars();
$this->addChange('renamed_columns', $options); $this->_addChange('renamed_columns', $options);
} }
/** /**
@ -539,7 +537,7 @@ class Doctrine_Migration
{ {
$options = get_defined_vars(); $options = get_defined_vars();
$this->addChange('changed_columns', $options); $this->_addChange('changed_columns', $options);
} }
/** /**
@ -553,7 +551,7 @@ class Doctrine_Migration
{ {
$options = get_defined_vars(); $options = get_defined_vars();
$this->addChange('removed_columns', $options); $this->_addChange('removed_columns', $options);
} }
/** /**
@ -568,7 +566,7 @@ class Doctrine_Migration
{ {
$options = get_defined_vars(); $options = get_defined_vars();
$this->addChange('added_indexes', $options); $this->_addChange('added_indexes', $options);
} }
/** /**
@ -582,6 +580,6 @@ class Doctrine_Migration
{ {
$options = get_defined_vars(); $options = get_defined_vars();
$this->addChange('removed_indexes', $options); $this->_addChange('removed_indexes', $options);
} }
} }