Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.2.0-BETA2
-
Fix Version/s: 1.2.0-BETA3
-
Component/s: Migrations
-
Labels:None
-
Environment:daily symfony 1.3 svn, doctrine 1.2.0-BETA2
Description
The second Doctrine_Migration instance is unusable.
It is very easy to reproduce the bug :
// first instance $migration = new Doctrine_Migration('/path/to/migration/classes'); print_r($migration->getMigrationClasses()); // will work, and show the migration classes as expected // same code, second instance $migration = new Doctrine_Migration('/path/to/migration/classes'); print_r($migration->getMigrationClasses()); // will not work. No more migration classes displayed.
This is due to the fact that Doctrine_Migration->loadMigrationClassesFromDirectory only registers classes that are not already loaded :
Doctrine_Migration->loadMigrationClassesFromDirectory
$array = array_diff(get_declared_classes(), $classes); $className = end($array);
If a migration class is already declared ( ie the second time we use Doctrine_Migration ), it will not be recognized.
Thank you for your great work.
I fixed Doctrine_Migration but this will still exist if you had previously loaded the class manually.
This is the only way we have to know what class is in a file, since the class name and file name aren't the same thing.