Doctrine 1
  1. Doctrine 1
  2. DC-192

Doctrine_Import_Builder Missing Relation Alias When Using classPrefix

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.0-BETA1
    • Fix Version/s: 1.2.0-BETA2
    • Component/s: Import/Export
    • Labels:
      None
    • Environment:
      PHP 5.2.x, Windows (All)

      Description

      Doctrine_Import_Builder, line 383

      $alias = (isset($relation['alias']) && $relation['alias'] !== $relation['class']) ? ' as ' . $relation['alias'] : '';

      For example, if both class name and alias is "User" and we make use of classPrefix (i.e "Model_"), the generated class name will actually be "Model_User". The comparison of:

      $relation['alias'] !== $relation['class']

      does not cover the prefix, which lead to the missing of alias when generating models, i.e

      $this->hasOne('Model_User', ...

      instead of

      $this->hasOne('Model_User as User', ...

      Suggested fix:

      $alias = (isset($relation['alias']) && $relation['alias'] !== $this->_classPrefix . $relation['class']) ? ' as ' . $relation['alias'] : '';

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            Jacky Nguyen
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: