Skip to content

Commit 94fc1e3

Browse files
vstaikovavbdr
authored andcommitted
Keep objects mapped (#763)
A fix for the objects mapping.
1 parent e3497b7 commit 94fc1e3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

dbObject.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -385,14 +385,14 @@ protected function get ($limit = null, $fields = null) {
385385
if ($this->db->count == 0)
386386
return null;
387387

388-
foreach ($results as &$r) {
388+
foreach ($results as $k => &$r) {
389389
$this->processArrays ($r);
390390
$this->data = $r;
391391
$this->processAllWith ($r, false);
392392
if ($this->returnType == 'Object') {
393393
$item = new static ($r);
394394
$item->isNew = false;
395-
$objects[] = $item;
395+
$objects[$k] = $item;
396396
}
397397
}
398398
$this->_with = Array();
@@ -476,14 +476,14 @@ private function paginate ($page, $fields = null) {
476476
self::$totalPages = $this->db->totalPages;
477477
if ($this->db->count == 0) return null;
478478

479-
foreach ($res as &$r) {
479+
foreach ($res as $k => &$r) {
480480
$this->processArrays ($r);
481481
$this->data = $r;
482482
$this->processAllWith ($r, false);
483483
if ($this->returnType == 'Object') {
484484
$item = new static ($r);
485485
$item->isNew = false;
486-
$objects[] = $item;
486+
$objects[$k] = $item;
487487
}
488488
}
489489
$this->_with = Array();

0 commit comments

Comments
 (0)