Changeset 5301

Show
Ignore:
Timestamp:
12/17/08 22:44:51 (7 months ago)
Author:
jwage
Message:

[1.0, 1.1] Fixing issue with resultset cache and joined records (closes #1636)

Location:
branches
Files:
2 added
4 modified

Legend:

Unmodified
Added
Removed
  • branches/1.0/lib/Doctrine/Query/Abstract.php

    r5260 r5301  
    935935    { 
    936936        $dql = $this->getDql(); 
    937         $params = $this->getParams($params); 
    938937        $conn = $this->getConnection(); 
    939938        $hash = md5($conn->getName() . $conn->getOption('dsn') . $dql . var_export($params, true)); 
     
    12011200        } 
    12021201 
     1202        if ($customComponent instanceof Doctrine_Collection) { 
     1203            foreach ($customComponent as $record) { 
     1204                $record->serializeReferences(true); 
     1205            } 
     1206        } 
     1207 
    12031208        return serialize(array($customComponent, $componentInfo, $this->getTableAliasMap())); 
    12041209    } 
  • branches/1.0/lib/Doctrine/Record.php

    r5300 r5301  
    153153 
    154154    /** 
     155     * Whether or not to serialize references when a Doctrine_Record is serialized 
     156     * 
     157     * @var boolean 
     158     */ 
     159    protected $_serializeReferences = false; 
     160 
     161    /** 
    155162     * @var integer $index                  this index is used for creating object identifiers 
    156163     */ 
     
    227234 
    228235        $this->construct(); 
     236    } 
     237 
     238    /** 
     239     * Set whether or not to serialize references. 
     240     * This is used by caching since we want to serialize references when caching 
     241     * but not when just normally serializing a instance 
     242     * 
     243     * @param boolean $bool 
     244     * @return boolean $bool 
     245     */ 
     246    public function serializeReferences($bool = null) 
     247    { 
     248        if ( ! is_null($bool)) { 
     249            $this->_serializeReferences = $bool; 
     250        } 
     251        return $this->_serializeReferences; 
    229252    } 
    230253 
     
    653676        $vars = get_object_vars($this); 
    654677 
    655         unset($vars['_references']); 
     678        if ( ! $this->serializeReferences()) { 
     679            unset($vars['_references']); 
     680        } 
    656681        unset($vars['_table']); 
    657682        unset($vars['_errorStack']); 
  • branches/1.1/lib/Doctrine/Query/Abstract.php

    r5260 r5301  
    997997    { 
    998998        $dql = $this->getDql(); 
    999         $params = $this->getParams($params); 
    1000999        $conn = $this->getConnection(); 
    10011000        $hash = md5($conn->getName() . $conn->getOption('dsn') . $dql . var_export($params, true)); 
     
    13031302        } 
    13041303 
     1304        if ($customComponent instanceof Doctrine_Collection) { 
     1305            foreach ($customComponent as $record) { 
     1306                $record->serializeReferences(true); 
     1307            } 
     1308        } 
     1309 
    13051310        return serialize(array($customComponent, $componentInfo, $this->getTableAliasMap())); 
    13061311    } 
  • branches/1.1/lib/Doctrine/Record.php

    r5300 r5301  
    170170 
    171171    /** 
     172     * Whether or not to serialize references when a Doctrine_Record is serialized 
     173     * 
     174     * @var boolean 
     175     */ 
     176    protected $_serializeReferences = false; 
     177 
     178    /** 
    172179     * @var integer $index                  this index is used for creating object identifiers 
    173180     */ 
     
    248255 
    249256        $this->construct(); 
     257    } 
     258 
     259    /** 
     260     * Set whether or not to serialize references. 
     261     * This is used by caching since we want to serialize references when caching 
     262     * but not when just normally serializing a instance 
     263     * 
     264     * @param boolean $bool 
     265     * @return boolean $bool 
     266     */ 
     267    public function serializeReferences($bool = null) 
     268    { 
     269        if ( ! is_null($bool)) { 
     270            $this->_serializeReferences = $bool; 
     271        } 
     272        return $this->_serializeReferences; 
    250273    } 
    251274 
     
    704727        $vars = get_object_vars($this); 
    705728 
    706         unset($vars['_references']); 
     729        if ( ! $this->serializeReferences()) { 
     730            unset($vars['_references']); 
     731        } 
    707732        unset($vars['_table']); 
    708733        unset($vars['_errorStack']);