Changeset 4359

Show
Ignore:
Timestamp:
05/10/08 10:16:42 (8 months ago)
Author:
romanb
Message:

Reverted patch for #917. Need more information.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/0.11/lib/Doctrine/Hydrator.php

    r4348 r4359  
    282282 
    283283        foreach ($data as $key => $value) { 
    284             // Parse each column name only once. Cache the results. 
    285             $e = explode('__', $key); 
    286             if(count($e) >= 2) { 
    287               if ( ! isset($cache[$key])) { 
    288                   $last = strtolower(array_pop($e)); 
    289                   $cache[$key]['dqlAlias'] = $this->_tableAliases[strtolower(implode('__', $e))]; 
    290                   $table = $this->_queryComponents[$cache[$key]['dqlAlias']]['table']; 
    291                   $fieldName = $table->getFieldName($last); 
    292                   $cache[$key]['fieldName'] = $fieldName; 
    293                   if ($table->isIdentifier($fieldName)) { 
    294                       $cache[$key]['isIdentifier'] = true; 
    295                   } else { 
    296                       $cache[$key]['isIdentifier'] = false; 
    297                   } 
    298                   $type = $table->getTypeOfColumn($last); 
    299                   if ($type == 'integer' || $type == 'string') { 
    300                       $cache[$key]['isSimpleType'] = true; 
    301                   } else { 
    302                       $cache[$key]['type'] = $type; 
    303                       $cache[$key]['isSimpleType'] = false; 
    304                   } 
    305               } 
    306  
    307               $map   = $this->_queryComponents[$cache[$key]['dqlAlias']]; 
    308               $table = $map['table']; 
    309               $dqlAlias = $cache[$key]['dqlAlias']; 
    310               $fieldName = $cache[$key]['fieldName']; 
    311  
    312               if (isset($this->_queryComponents[$dqlAlias]['agg'][$fieldName])) { 
    313                   $fieldName = $this->_queryComponents[$dqlAlias]['agg'][$fieldName]; 
    314               } 
    315  
    316               if ($cache[$key]['isIdentifier']) { 
    317                   $id[$dqlAlias] .= '|' . $value; 
    318               } 
    319  
    320               if ($cache[$key]['isSimpleType']) { 
    321                   $rowData[$dqlAlias][$fieldName] = $value; 
    322               } else { 
    323                   $rowData[$dqlAlias][$fieldName] = $table->prepareValue( 
    324                           $fieldName, $value, $cache[$key]['type']); 
    325               } 
    326  
    327               if ( ! isset($nonemptyComponents[$dqlAlias]) && $value !== null) { 
    328                   $nonemptyComponents[$dqlAlias] = true; 
    329               } 
     284            // Parse each column name only once. Cache the results.  
     285            if ( ! isset($cache[$key])) { 
     286                $e = explode('__', $key); 
     287                $last = strtolower(array_pop($e)); 
     288                $cache[$key]['dqlAlias'] = $this->_tableAliases[strtolower(implode('__', $e))]; 
     289                $table = $this->_queryComponents[$cache[$key]['dqlAlias']]['table']; 
     290                $fieldName = $table->getFieldName($last); 
     291                $cache[$key]['fieldName'] = $fieldName; 
     292                if ($table->isIdentifier($fieldName)) { 
     293                    $cache[$key]['isIdentifier'] = true; 
     294                } else { 
     295                  $cache[$key]['isIdentifier'] = false; 
     296                } 
     297                $type = $table->getTypeOfColumn($last); 
     298                if ($type == 'integer' || $type == 'string') { 
     299                    $cache[$key]['isSimpleType'] = true; 
     300                } else { 
     301                    $cache[$key]['type'] = $type; 
     302                    $cache[$key]['isSimpleType'] = false; 
     303                } 
     304            } 
     305 
     306            $map = $this->_queryComponents[$cache[$key]['dqlAlias']]; 
     307            $table = $map['table']; 
     308            $dqlAlias = $cache[$key]['dqlAlias']; 
     309            $fieldName = $cache[$key]['fieldName']; 
     310            if (isset($this->_queryComponents[$dqlAlias]['agg'][$fieldName])) { 
     311                $fieldName = $this->_queryComponents[$dqlAlias]['agg'][$fieldName]; 
     312            } 
     313 
     314            if ($cache[$key]['isIdentifier']) { 
     315                $id[$dqlAlias] .= '|' . $value; 
     316            } 
     317 
     318            if ($cache[$key]['isSimpleType']) { 
     319                $rowData[$dqlAlias][$fieldName] = $value; 
     320            } else { 
     321                $rowData[$dqlAlias][$fieldName] = $table->prepareValue( 
     322                        $fieldName, $value, $cache[$key]['type']); 
     323            } 
     324 
     325            if ( ! isset($nonemptyComponents[$dqlAlias]) && $value !== null) { 
     326                $nonemptyComponents[$dqlAlias] = true; 
    330327            } 
    331328        }