Skip to content

Commit

Permalink
fix quotation for defaultmysql (#171)
Browse files Browse the repository at this point in the history
* fix quotation for defaultmysql

* fix quotation for defaultmysql

* fix quotation for defaultmysql - remove typehints
  • Loading branch information
AlternateIf authored Mar 21, 2024
1 parent 95e2f7e commit f37c2d5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/IndexService/ProductList/DefaultMysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -618,9 +618,9 @@ protected function buildOrderBy(): ?string

if ($this->getVariantMode() == ProductListInterface::VARIANT_MODE_INCLUDE_PARENT_OBJECT) {
if (strtoupper($this->order) == 'DESC') {
$orderByStringArray[] = 'max(`' . $key . '`) ' . $direction;
$orderByStringArray[] = 'max(' . $this->resource->quoteIdentifier($key) . ') ' . $direction;
} else {
$orderByStringArray[] = 'min(`' . $key . '`) ' . $direction;
$orderByStringArray[] = 'min(' . $this->resource->quoteIdentifier($key) . ') ' . $direction;
}
} else {
$orderByStringArray[] = $key . ' ' . $direction;
Expand Down
5 changes: 5 additions & 0 deletions src/IndexService/ProductList/DefaultMysql/Dao.php
Original file line number Diff line number Diff line change
Expand Up @@ -299,4 +299,9 @@ public function getLastRecordCount(): int
{
return $this->lastRecordCount;
}

public function quoteIdentifier(string $value): string
{
return $this->db->quoteIdentifier($value);
}
}

0 comments on commit f37c2d5

Please sign in to comment.