Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.2.0-ALPHA2
-
Fix Version/s: 1.2.0-BETA2
-
Component/s: Migrations
-
Labels:None
-
Environment:daily symfony 1.3 svn
Description
When I need to create a Doctrine_Migration twice during a same php processus, the migrations version numbers get wrong.
In Doctrine_Migration->loadMigrationClassesFromDirectory method, I see :
if (isset(self::$_migrationClassesForDirectories[$directory])) { $migrationClasses = (array) self::$_migrationClassesForDirectories[$directory]; $this->_migrationClasses = array_merge($migrationClasses, $this->_migrationClasses); }
The problem is that array_merge loose the array keys. In the $this->_migrationClasses context, array keys are very important because they are the version numbers.
So when if (isset(self::$_migrationClassesForDirectories[$directory])) is true ( ie the second time we use the Doctrine_Migration classs ) all the migrations versions get wrong.
I hope my description is clear enough.
After looking at it, that code didn't make sense and it could never work, you are right. I removed it. Now if you call that function twice it will reset everything and reload the classes from the configured directories.