Skip to content

Commit

Permalink
fixup! fix: add failing test when aliasing a column of a joined relation
Browse files Browse the repository at this point in the history
  • Loading branch information
alquerci committed Apr 16, 2024
1 parent 6d65332 commit 693ca6d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/Doctrine/Hydrator/ArrayDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,27 @@ public function setLastElement(&$prev, &$coll, $index, $dqlAlias, $oneToOne)
}

protected function beforeAddingAggregateValue($rowData, $cache, $dqlAlias, $value)
{
$rowData = $this->addSelectedRelationToRowData($rowData, $dqlAlias, $cache);

$rowData = $this->addIdentifierColumnToRowData($rowData, $cache, $dqlAlias, $value);

return $rowData;
}

private function addSelectedRelationToRowData($rowData, $dqlAlias, $cache)
{
if (!isset($rowData[$dqlAlias])) {
if ($cache['isRelation']) {
$rowData[$dqlAlias] = array();
}
}

return $rowData;
}

private function addIdentifierColumnToRowData($cache, $rowData, $dqlAlias, $value)
{
if ($cache['isIdentifier'] && !isset($rowData[$dqlAlias][$cache['columnName']])) {
$rowData[$dqlAlias][$cache['columnName']] = $value;
}
Expand Down

0 comments on commit 693ca6d

Please sign in to comment.