Skip to content

Commit 7c271db

Browse files
Merge pull request #5713 in SW/shopware from sw-19895/5.3/improve-conditionhelper to 5.3
* commit 'f88bbede6c258bc7be5f42c5eccec80e0b4aa100': SW-19895 - Improve condition parser to make it more compatible with different cases of column names
2 parents bd97983 + f88bbed commit 7c271db

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

engine/Shopware/Bundle/SearchBundleDBAL/ConditionHandler/DynamicConditionParserTrait.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,11 @@ public function parse(QueryBuilder $query, $table, $tableAlias, $field = null, $
6666
throw new \RuntimeException("Could not retrieve columns from '$table'");
6767
}
6868

69-
if (!array_key_exists($field, $columns)) {
69+
$names = array_map(function (\Doctrine\DBAL\Schema\Column $column) {
70+
return strtolower($column->getName());
71+
}, $columns);
72+
73+
if (!array_key_exists(strtolower($field), $names)) {
7074
throw new \InvalidArgumentException("Invalid column name specified '$field'", 1);
7175
}
7276

@@ -85,7 +89,7 @@ public function parse(QueryBuilder $query, $table, $tableAlias, $field = null, $
8589
Condition::OPERATOR_CONTAINS,
8690
];
8791

88-
//Normalize with strtoupper in case of non-algorithmic comparisons NOT IN, IN, STARTS WITH
92+
// Normalize with strtoupper in case of non-algorithmic comparisons NOT IN, IN, STARTS WITH
8993
$operator = strtoupper(trim($operator));
9094

9195
/*

0 commit comments

Comments
 (0)