Changeset 3536

Show
Ignore:
Timestamp:
01/17/08 13:25:04 (18 months ago)
Author:
guilhermeblanco
Message:

Added a fix in toArray method to prevent mapped Doctrine_Record values to be displayed fully

Location:
branches
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • branches/0.10/lib/Doctrine/Record.php

    r3434 r3536  
    12031203                $value = null; 
    12041204            } 
     1205 
    12051206            $a[$column] = $value; 
    12061207        } 
     
    12131214        if ($deep) { 
    12141215            foreach ($this->_references as $key => $relation) { 
    1215                 if ( ! $relation instanceof Doctrine_Null) { 
     1216                if (! $relation instanceof Doctrine_Null) { 
    12161217                    $a[$key] = $relation->toArray($deep, $prefixKey); 
    12171218                } 
     
    12191220        } 
    12201221 
    1221         return array_merge($a, $this->_values); 
     1222        // [FIX] Prevent mapped Doctrine_Records from being displayed fully 
     1223        foreach ($this->_values as $key => $value) { 
     1224            if ($value instanceof Doctrine_Record) { 
     1225                $a[$key] = $value->toArray($deep, $prefixKey); 
     1226            } else { 
     1227                $a[$key] = $value; 
     1228            } 
     1229        } 
     1230 
     1231        return $a; 
    12221232    } 
    12231233 
  • branches/0.9/lib/Doctrine/Record.php

    r3515 r3536  
    11891189                $value = null; 
    11901190            } 
     1191 
    11911192            $a[$column] = $value; 
    11921193        } 
     1194 
    11931195        if ($this->_table->getIdentifierType() ==  Doctrine::IDENTIFIER_AUTOINC) { 
    11941196            $i      = $this->_table->getIdentifier(); 
    11951197            $a[$i]  = $this->getIncremented(); 
    11961198        } 
     1199 
    11971200        if ($deep) { 
    11981201            foreach ($this->_references as $key => $relation) { 
    1199                 if ( ! $relation instanceof Doctrine_Null) { 
     1202                if (! $relation instanceof Doctrine_Null) { 
    12001203                    $a[$key] = $relation->toArray($deep, $prefixKey); 
    12011204                } 
    12021205            } 
    12031206        } 
    1204         return array_merge($a, $this->_values); 
     1207 
     1208        // [FIX] Prevent mapped Doctrine_Records from being displayed fully 
     1209        foreach ($this->_values as $key => $value) { 
     1210            if ($value instanceof Doctrine_Record) { 
     1211                $a[$key] = $value->toArray($deep, $prefixKey); 
     1212            } else { 
     1213                $a[$key] = $value; 
     1214            } 
     1215        } 
     1216 
     1217        return $a; 
    12051218    } 
    12061219