Skip to content

Commit

Permalink
Treat attribute names as case-insensitive for result management (CO-1…
Browse files Browse the repository at this point in the history
…715)
  • Loading branch information
Benn Oshrin committed Mar 21, 2019
1 parent ec552bb commit 57bc7cb
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions app/src/Lib/Match/ResultManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
Expand Down Expand Up @@ -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;
}
}
}

0 comments on commit 57bc7cb

Please sign in to comment.