Changeset 5016
- Timestamp:
- 10/01/08 19:55:50 (3 months ago)
- Location:
- branches/1.1/lib/Doctrine
- Files:
-
- 3 modified
-
Hydrator.php (modified) (3 diffs)
-
Hydrator/ArrayDriver.php (modified) (1 diff)
-
Hydrator/RecordDriver.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/1.1/lib/Doctrine/Hydrator.php
r5003 r5016 156 156 } 157 157 158 $ this->_setLastElement($prev, $result, $index, $rootAlias, false);158 $driver->setLastElement($prev, $result, $index, $rootAlias, false); 159 159 unset($rowData[$rootAlias]); 160 160 … … 238 238 if ($prev[$parent][$relationAlias] !== null) { 239 239 $coll =& $prev[$parent][$relationAlias]; 240 $ this->_setLastElement($prev, $coll, $index, $dqlAlias, $oneToOne);240 $driver->setLastElement($prev, $coll, $index, $dqlAlias, $oneToOne); 241 241 } 242 242 } … … 249 249 250 250 return $result; 251 }252 253 /**254 * sets the last element of given data array / collection255 * as previous element256 *257 * @param boolean|integer $index258 * @return void259 * @todo Detailed documentation260 */261 protected function _setLastElement(&$prev, &$coll, $index, $dqlAlias, $oneToOne)262 {263 if ($coll === self::$_null || $coll === null) {264 unset($prev[$dqlAlias]); // Ticket #1228265 return;266 }267 268 if ($index !== false) {269 // Link element at $index to previous element for the component270 // identified by the DQL alias $alias271 $prev[$dqlAlias] =& $coll[$index];272 return;273 }274 275 if (is_array($coll) && $coll) {276 if ($oneToOne) {277 $prev[$dqlAlias] =& $coll;278 } else {279 end($coll);280 $prev[$dqlAlias] =& $coll[key($coll)];281 }282 } else if (count($coll) > 0) {283 $prev[$dqlAlias] = $coll->getLast();284 }285 251 } 286 252 -
branches/1.1/lib/Doctrine/Hydrator/ArrayDriver.php
r4263 r5016 68 68 return key($data); 69 69 } 70 71 /** 72 * sets the last element of given data array / collection 73 * as previous element 74 * 75 * @param boolean|integer $index 76 * @return void 77 * @todo Detailed documentation 78 */ 79 public function setLastElement(&$prev, &$coll, $index, $dqlAlias, $oneToOne) 80 { 81 if ($coll === null) { 82 unset($prev[$dqlAlias]); // Ticket #1228 83 return; 84 } 85 86 if ($index !== false) { 87 // Link element at $index to previous element for the component 88 // identified by the DQL alias $alias 89 $prev[$dqlAlias] =& $coll[$index]; 90 return; 91 } 92 93 if ($coll) { 94 if ($oneToOne) { 95 $prev[$dqlAlias] =& $coll; 96 } else { 97 end($coll); 98 $prev[$dqlAlias] =& $coll[key($coll)]; 99 } 100 } 101 } 70 102 71 103 public function flush() -
branches/1.1/lib/Doctrine/Hydrator/RecordDriver.php
r4341 r5016 105 105 106 106 /** 107 * sets the last element of given data array / collection 108 * as previous element 109 * 110 * @param boolean|integer $index 111 * @return void 112 * @todo Detailed documentation 113 */ 114 public function setLastElement(&$prev, &$coll, $index, $dqlAlias, $oneToOne) 115 { 116 if ($coll === self::$_null) { 117 unset($prev[$dqlAlias]); // Ticket #1228 118 return; 119 } 120 121 if ($index !== false) { 122 // Link element at $index to previous element for the component 123 // identified by the DQL alias $alias 124 $prev[$dqlAlias] = $coll[$index]; 125 return; 126 } 127 128 if (count($coll) > 0) { 129 $prev[$dqlAlias] = $coll->getLast(); 130 } 131 } 132 133 /** 107 134 * Get the classname to return. Most often this is just the options['name'] 108 135 *