Changeset 5301
- Timestamp:
- 12/17/08 22:44:51 (7 months ago)
- Location:
- branches
- Files:
-
- 2 added
- 4 modified
-
1.0/lib/Doctrine/Query/Abstract.php (modified) (2 diffs)
-
1.0/lib/Doctrine/Record.php (modified) (3 diffs)
-
1.0/tests/Ticket/1636TestCase.php (added)
-
1.1/lib/Doctrine/Query/Abstract.php (modified) (2 diffs)
-
1.1/lib/Doctrine/Record.php (modified) (3 diffs)
-
1.1/tests/Ticket/1636TestCase.php (added)
Legend:
- Unmodified
- Added
- Removed
-
branches/1.0/lib/Doctrine/Query/Abstract.php
r5260 r5301 935 935 { 936 936 $dql = $this->getDql(); 937 $params = $this->getParams($params);938 937 $conn = $this->getConnection(); 939 938 $hash = md5($conn->getName() . $conn->getOption('dsn') . $dql . var_export($params, true)); … … 1201 1200 } 1202 1201 1202 if ($customComponent instanceof Doctrine_Collection) { 1203 foreach ($customComponent as $record) { 1204 $record->serializeReferences(true); 1205 } 1206 } 1207 1203 1208 return serialize(array($customComponent, $componentInfo, $this->getTableAliasMap())); 1204 1209 } -
branches/1.0/lib/Doctrine/Record.php
r5300 r5301 153 153 154 154 /** 155 * Whether or not to serialize references when a Doctrine_Record is serialized 156 * 157 * @var boolean 158 */ 159 protected $_serializeReferences = false; 160 161 /** 155 162 * @var integer $index this index is used for creating object identifiers 156 163 */ … … 227 234 228 235 $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; 229 252 } 230 253 … … 653 676 $vars = get_object_vars($this); 654 677 655 unset($vars['_references']); 678 if ( ! $this->serializeReferences()) { 679 unset($vars['_references']); 680 } 656 681 unset($vars['_table']); 657 682 unset($vars['_errorStack']); -
branches/1.1/lib/Doctrine/Query/Abstract.php
r5260 r5301 997 997 { 998 998 $dql = $this->getDql(); 999 $params = $this->getParams($params);1000 999 $conn = $this->getConnection(); 1001 1000 $hash = md5($conn->getName() . $conn->getOption('dsn') . $dql . var_export($params, true)); … … 1303 1302 } 1304 1303 1304 if ($customComponent instanceof Doctrine_Collection) { 1305 foreach ($customComponent as $record) { 1306 $record->serializeReferences(true); 1307 } 1308 } 1309 1305 1310 return serialize(array($customComponent, $componentInfo, $this->getTableAliasMap())); 1306 1311 } -
branches/1.1/lib/Doctrine/Record.php
r5300 r5301 170 170 171 171 /** 172 * Whether or not to serialize references when a Doctrine_Record is serialized 173 * 174 * @var boolean 175 */ 176 protected $_serializeReferences = false; 177 178 /** 172 179 * @var integer $index this index is used for creating object identifiers 173 180 */ … … 248 255 249 256 $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; 250 273 } 251 274 … … 704 727 $vars = get_object_vars($this); 705 728 706 unset($vars['_references']); 729 if ( ! $this->serializeReferences()) { 730 unset($vars['_references']); 731 } 707 732 unset($vars['_table']); 708 733 unset($vars['_errorStack']);