From f88bbede6c258bc7be5f42c5eccec80e0b4aa100 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hendrik=20S=C3=B6bbing?= Date: Tue, 24 Oct 2017 10:09:10 +0200 Subject: [PATCH] SW-19895 - Improve condition parser to make it more compatible with different cases of column names --- .../ConditionHandler/DynamicConditionParserTrait.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/engine/Shopware/Bundle/SearchBundleDBAL/ConditionHandler/DynamicConditionParserTrait.php b/engine/Shopware/Bundle/SearchBundleDBAL/ConditionHandler/DynamicConditionParserTrait.php index 1dfcbc33f33..a6061599b37 100644 --- a/engine/Shopware/Bundle/SearchBundleDBAL/ConditionHandler/DynamicConditionParserTrait.php +++ b/engine/Shopware/Bundle/SearchBundleDBAL/ConditionHandler/DynamicConditionParserTrait.php @@ -66,7 +66,11 @@ public function parse(QueryBuilder $query, $table, $tableAlias, $field = null, $ throw new \RuntimeException("Could not retrieve columns from '$table'"); } - if (!array_key_exists($field, $columns)) { + $names = array_map(function (\Doctrine\DBAL\Schema\Column $column) { + return strtolower($column->getName()); + }, $columns); + + if (!array_key_exists(strtolower($field), $names)) { throw new \InvalidArgumentException("Invalid column name specified '$field'", 1); } @@ -85,7 +89,7 @@ public function parse(QueryBuilder $query, $table, $tableAlias, $field = null, $ Condition::OPERATOR_CONTAINS, ]; - //Normalize with strtoupper in case of non-algorithmic comparisons NOT IN, IN, STARTS WITH + // Normalize with strtoupper in case of non-algorithmic comparisons NOT IN, IN, STARTS WITH $operator = strtoupper(trim($operator)); /*