Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-925

Breaks with Fixing Identification Variables and SQL Walkers - 2

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-RC1
    • Fix Version/s: 2.0-RC2
    • Component/s: ORM
    • Security Level: All
    • Labels:
      None
    • Environment:
      Ubuntu

      Description

      Here is a part from the file with bug code.

      Doctrine/ORM/Query/Parser.php
      Unable to find source-code formatter for language: php. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml
      // Fix order of identification variables.
      // They have to appear in the select clause in the same order as the
      // declarations (from ... x join ... y join ... z ...) appear in the query
      // as the hydration process relies on that order for proper operation.
      if ( count($this->_identVariableExpressions) > 1) {
        foreach ($this->_queryComponents as $dqlAlias => $qComp) {
          if (isset($this->_identVariableExpressions[$dqlAlias])) {
            $expr = $this->_identVariableExpressions[$dqlAlias];
            $key = array_search($expr, $AST->selectClause->selectExpressions);
            unset($AST->selectClause->selectExpressions[$key]);
            $AST->selectClause->selectExpressions[] = $expr;
          }
        }
      }
      
      

      Bug details

      Doctrine/ORM/Query/Parser.php
      Unable to find source-code formatter for language: php. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml
      $key = array_search($expr, $AST->selectClause->selectExpressions);
      unset($AST->selectClause->selectExpressions[$key]);
            
      

      When array_search function return false (no match).
      Then on the next line wrong array element deleted, because (int) false = 0
      }:-[

        Issue Links

          Activity

          Hide
          Benjamin Eberlei added a comment -

          Add test, this issue does not appear anymore with the fix for DDC-915.

          Show
          Benjamin Eberlei added a comment - Add test, this issue does not appear anymore with the fix for DDC-915 .

            People

            • Assignee:
              Roman S. Borschel
              Reporter:
              gektor
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: