Skip to content

Commit

Permalink
[Bug]: Quote sorting key (#15523)
Browse files Browse the repository at this point in the history
* quote sorting key

* add quoting to order key with `?` case too

* refactor, no need to get Db

* break line to fix codesmell

* improve spacing

* remove trailing space
  • Loading branch information
kingjia90 committed Jul 13, 2023
1 parent 8a435ad commit e641968
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions bundles/AdminBundle/Helper/GridHelperService.php
Original file line number Diff line number Diff line change
Expand Up @@ -571,15 +571,16 @@ public function prepareListingForGrid(array $requestParams, string $requestedLan
if (strpos($orderKey, '?') !== false) {
$brickDescriptor = substr($orderKeyParts[0], 1);
$brickDescriptor = json_decode($brickDescriptor, true);
$db = Db::get();
$orderKey = $db->quoteIdentifier($brickDescriptor['containerKey'] . '_localized') . '.' . $db->quoteIdentifier($brickDescriptor['brickfield']);
$orderKey = $list->quoteIdentifier($brickDescriptor['containerKey'] . '_localized')
. '.' . $list->quoteIdentifier($brickDescriptor['brickfield']);
$doNotQuote = true;
} elseif (count($orderKeyParts) === 2) {
$orderKey = $orderKeyParts[0].'.'.$orderKeyParts[1];
$orderKey = $list->quoteIdentifier($orderKeyParts[0])
. '.' . $list->quoteIdentifier($orderKeyParts[1]);
$doNotQuote = true;
}
} else {
$orderKey = $list->getDao()->getTableName().'.'.$orderKey;
$orderKey = $list->getDao()->getTableName() . '.' . $list->quoteIdentifier($orderKey);
$doNotQuote = true;
}
}
Expand Down

0 comments on commit e641968

Please sign in to comment.