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

Schema importer sometimes overwrites relations (instead of adding them) due to issue with bugfix DC-281


    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.2.0, 1.2.1, 1.2.2, 1.2.3
    • Fix Version/s: None
    • Component/s: Import/Export
    • Labels:


      The bugfix for DC-281 (r6802) contains an issue:

      When between two tables in a MySQL database there are two relations, one on both sides (i.e. both tables have a FK field to each other), one of the two is overwritten with the second by the schema importer. That is, at one class, there seems to be only one relation instead of both.

      The issue came in when the decision was made to store all class names in the definition array lower case, as one of the lookups in the array was not updated appropriately.

      See Doctrine/Import.php (1.2.4) line 416 - 435. In line 427, you can clearly see the change made in 6802

      $definitions[$relation['class']]['relations'][$alias] = array(
      $definitions[strtolower($relation['class'])]['relations'][$alias] = array(

      Line 421 however should also have been updated:

      if (in_array($relation['class'], $relClasses) || isset($definitions[$relation['class']]['relations'][$className])) {
      Proposed fix:
      if (in_array($relation['class'], $relClasses) || isset($definitions[strtolower($relation['class'])]['relations'][$className])) {

      This error results in relations that already exist sometimes being overwritten.


        There are no comments yet on this issue.


          • Assignee:
            jwage Jonathan H. Wage
            pelleke Pelle ten Cate
          • Votes:
            0 Vote for this issue
            0 Start watching this issue


            • Created: