Uploaded image for project: 'Doctrine 1'
  1. Doctrine 1
  2. DC-767

Doctrine_Migration_Builder::generateMigrationClass() improperly loads migration class


    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.2.2
    • Fix Version/s: None
    • Component/s: Migrations
    • Labels:
    • Environment:


      in function: Doctrine_Migration_Builder::generateMigrationClass() the generated migration class is included (require_once) after creation. A loadMigrationClass call is made following [line 513] as:


      I propose this should change to include the optional "$path" argument to Doctrine_Migration::loadMigrationClass() as:

      $this->migration->loadMigrationClass($className, $path);

      Since the $path variable is available for the loadMigrationClass it should be included. More importantly NOT including $path breaks the certains behaviors. This occurs as a side effect in symfony for instance when creating a new task that chains:


      The reason for the problem is because the generate-migrations-diff properly creates the version class and file and then has a require_once that pulls the class into scope. doctrine:migrate then runs Doctrine_Migration::loadMigrationClassesFromDirectory() to find all the migration classes. The task does NOT see the newly created migration class because it is not associated with the directory dirname($path) pointed out above. The function thoroughly scans the migration class directory with require_once and array_diff's to find new classes. But the new migrations class is already within declaration scope so is missed. Thus the doctrine:migrate task always migrates to the version BEFORE the executed doctrine:generate-migration-diff.


        There are no comments yet on this issue.


          • Assignee:
            jwage Jonathan H. Wage
            bfranzke Brandon Franzke
          • Votes:
            0 Vote for this issue
            0 Start watching this issue


            • Created: