From 57bc7cbff1914e5e6f66889e15e943532da146da Mon Sep 17 00:00:00 2001 From: Benn Oshrin Date: Wed, 20 Mar 2019 20:51:32 -0400 Subject: [PATCH] Treat attribute names as case-insensitive for result management (CO-1715) --- app/src/Lib/Match/ResultManager.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/app/src/Lib/Match/ResultManager.php b/app/src/Lib/Match/ResultManager.php index 92b05c0f4..94fc5263f 100644 --- a/app/src/Lib/Match/ResultManager.php +++ b/app/src/Lib/Match/ResultManager.php @@ -65,17 +65,21 @@ public function add(array $attributes) { $parsed = []; foreach($attributes as $name => $value) { - if($name == 'id') { + // We treat all names as case insensitive since the database column name + // is case insensitive. + $lname = strtolower($name); + + if($lname == 'id') { $rowId = $value; - } elseif($name == 'referenceid') { + } elseif($lname == 'referenceid') { $referenceId = $value; } else { // Store keyed on the API name, not the database name - if(!empty($this->attrconfig[$name])) { - $parsed[ $this->attrconfig[$name] ] = $value; + if(!empty($this->attrconfig[$lname])) { + $parsed[ $this->attrconfig[$lname] ] = $value; } else { // eg: sor - $parsed[$name] = $value; + $parsed[$lname] = $value; } } } @@ -275,7 +279,9 @@ public function setConfig(array $config) { $apiname .= '/' . $attr->attribute_group->name; } - $this->attrconfig[ $attr->name ] = $apiname; + // We treat attributes names as case insensitive since the database column + // is case insensitive. + $this->attrconfig[ strtolower($attr->name) ] = $apiname; } } }