Skip to content

Commit

Permalink
Query: Determine omitted & target columns correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
yhabteab committed Sep 20, 2024
1 parent e9d6117 commit d9bd9fb
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,21 @@ public function assembleSelect()
foreach ($resolved as $target) {
$targetColumns = $resolved[$target]->getArrayCopy();
if (isset($omitted[$target])) {
$targetColumns = array_diff($targetColumns, $omitted[$target]->getArrayCopy());
$targetColumns = array_udiff(
$targetColumns,
$omitted[$target]->getArrayCopy(),
function ($a, $b) {
if (! is_string($a)) {
return 1;
}

if (! is_string($b)) {
return -1;
}

return strcmp($a, $b);
}
);
}

if (! empty($customAliases)) {
Expand Down

0 comments on commit d9bd9fb

Please sign in to comment.