Changeset 4965 for trunk/lib/Doctrine

Show
Ignore:
Timestamp:
09/13/08 21:06:49 (4 months ago)
Author:
romanb
Message:

Some array/object related fixes to hydration

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/lib/Doctrine/ORM/Internal/Hydration/StandardHydrator.php

    r4964 r4965  
    151151                throw Doctrine_ORM_Exceptions_HydrationException::nonUniqueResult(); 
    152152            } 
    153             return array_shift($this->_gatherScalarRowData($result[0], $cache));  
     153            $result = $this->_gatherScalarRowData($result[0], $cache); 
     154            return array_shift($result); 
    154155        } 
    155156         
     
    246247                        } 
    247248                    } else if ( ! isset($baseElement[$relationAlias])) { 
    248                         $driver->setRelatedElement($baseElement, $relationAlias, 
    249                                 $driver->getElementCollection($entityName)); 
     249                        if ($hydrationMode == Doctrine_Query::HYDRATE_ARRAY) { 
     250                            $array = array(); 
     251                            $driver->setRelatedElement($baseElement, $relationAlias, $array); 
     252                        } else { 
     253                            $driver->setRelatedElement($baseElement, $relationAlias, 
     254                                    $driver->getElementCollection($entityName)); 
     255                        } 
    250256                    } 
    251257                } else { 
     
    261267                    } 
    262268                } 
    263                 if (($coll =& $driver->getReferenceValue($baseElement, $relationAlias)) !== null) { 
    264                     $this->_updateResultPointer($resultPointers, $coll, $index, $dqlAlias, $oneToOne);    
    265                 } 
     269                if ($hydrationMode == Doctrine_Query::HYDRATE_ARRAY) { 
     270                    if (($coll =& $driver->getReferenceValue($baseElement, $relationAlias)) !== null) { 
     271                        $this->_updateResultPointer($resultPointers, $coll, $index, $dqlAlias, $oneToOne);    
     272                    } 
     273                } else { 
     274                    if (($coll = $driver->getReferenceValue($baseElement, $relationAlias)) !== null) { 
     275                        $this->_updateResultPointer($resultPointers, $coll, $index, $dqlAlias, $oneToOne);    
     276                    } 
     277                } 
     278 
    266279            } 
    267280