Skip to content

Commit

Permalink
Merge pull request #5713 in SW/shopware from sw-19895/5.3/improve-con…
Browse files Browse the repository at this point in the history
…ditionhelper to 5.3

* commit 'f88bbede6c258bc7be5f42c5eccec80e0b4aa100':
  SW-19895 - Improve condition parser to make it more compatible with different cases of column names
  • Loading branch information
OliverSkroblin committed Oct 24, 2017
2 parents bd97983 + f88bbed commit 7c271db
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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));

/*
Expand Down

0 comments on commit 7c271db

Please sign in to comment.