| @@ 314-338 (lines=25) @@ | ||
| 311 | * @throws PropelException Any exceptions caught during processing will be |
|
| 312 | * rethrown wrapped into a PropelException. |
|
| 313 | */ |
|
| 314 | public static function populateObjects(DataFetcherInterface $dataFetcher) |
|
| 315 | { |
|
| 316 | $results = array(); |
|
| 317 | ||
| 318 | // set the class once to avoid overhead in the loop |
|
| 319 | $cls = static::getOMClass(false); |
|
| 320 | // populate the object(s) |
|
| 321 | while ($row = $dataFetcher->fetch()) { |
|
| 322 | $key = RecordTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); |
|
| 323 | if (null !== ($obj = RecordTableMap::getInstanceFromPool($key))) { |
|
| 324 | // We no longer rehydrate the object, since this can cause data loss. |
|
| 325 | // See http://www.propelorm.org/ticket/509 |
|
| 326 | // $obj->hydrate($row, 0, true); // rehydrate |
|
| 327 | $results[] = $obj; |
|
| 328 | } else { |
|
| 329 | /** @var Record $obj */ |
|
| 330 | $obj = new $cls(); |
|
| 331 | $obj->hydrate($row); |
|
| 332 | $results[] = $obj; |
|
| 333 | RecordTableMap::addInstanceToPool($obj, $key); |
|
| 334 | } // if key exists |
|
| 335 | } |
|
| 336 | ||
| 337 | return $results; |
|
| 338 | } |
|
| 339 | /** |
|
| 340 | * Add all the columns needed to create a new object. |
|
| 341 | * |
|
| @@ 290-314 (lines=25) @@ | ||
| 287 | * @throws PropelException Any exceptions caught during processing will be |
|
| 288 | * rethrown wrapped into a PropelException. |
|
| 289 | */ |
|
| 290 | public static function populateObjects(DataFetcherInterface $dataFetcher) |
|
| 291 | { |
|
| 292 | $results = array(); |
|
| 293 | ||
| 294 | // set the class once to avoid overhead in the loop |
|
| 295 | $cls = static::getOMClass(false); |
|
| 296 | // populate the object(s) |
|
| 297 | while ($row = $dataFetcher->fetch()) { |
|
| 298 | $key = PlayerTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); |
|
| 299 | if (null !== ($obj = PlayerTableMap::getInstanceFromPool($key))) { |
|
| 300 | // We no longer rehydrate the object, since this can cause data loss. |
|
| 301 | // See http://www.propelorm.org/ticket/509 |
|
| 302 | // $obj->hydrate($row, 0, true); // rehydrate |
|
| 303 | $results[] = $obj; |
|
| 304 | } else { |
|
| 305 | /** @var Player $obj */ |
|
| 306 | $obj = new $cls(); |
|
| 307 | $obj->hydrate($row); |
|
| 308 | $results[] = $obj; |
|
| 309 | PlayerTableMap::addInstanceToPool($obj, $key); |
|
| 310 | } // if key exists |
|
| 311 | } |
|
| 312 | ||
| 313 | return $results; |
|
| 314 | } |
|
| 315 | /** |
|
| 316 | * Add all the columns needed to create a new object. |
|
| 317 | * |
|