Skip to content

Commit 12cede2

Browse files
committed
Reworked exchangeArray in RowGateway to correct behaviour
1 parent 7d3fb79 commit 12cede2

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

‎src/RowGateway/AbstractRowGateway.php‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,27 +67,30 @@ public function initialize(): void
6767
/**
6868
* Populate Data
6969
*/
70-
public function populate(array $rowData, bool $rowExistsInDatabase = false): array
70+
public function populate(array $rowData, bool $rowExistsInDatabase = false): RowGatewayInterface
7171
{
7272
$this->initialize();
7373

74-
$oldData = $this->data;
7574
$this->data = $rowData;
7675
if ($rowExistsInDatabase === true) {
7776
$this->processPrimaryKeyData();
7877
} else {
7978
$this->primaryKeyData = null;
8079
}
8180

82-
return $oldData;
81+
return $this;
8382
}
8483

8584
/**
8685
* todo: Refactor to a standard ArrayObject implementation - remove proxy to populate
8786
*/
8887
public function exchangeArray(array $array): array
8988
{
90-
return $this->populate($array, true);
89+
$oldData = $this->data;
90+
91+
$this->populate($array, true);
92+
93+
return $oldData;
9194
}
9295

9396
#[Override]

0 commit comments

Comments
 (0)