CRM-17795 - Fix uniqueName handling in api.get
authorColeman Watts <coleman@civicrm.org>
Thu, 7 Jan 2016 19:23:52 +0000 (14:23 -0500)
committerColeman Watts <coleman@civicrm.org>
Sat, 9 Jan 2016 01:51:02 +0000 (20:51 -0500)
Civi/API/SelectQuery.php

index f9006e97d6333dc2c676b99eb8455572f06ba2e1..fa5dec4351d14da242fc0a13f0dd502a2e48b5d7 100644 (file)
@@ -282,8 +282,8 @@ class SelectQuery {
           $result_entities[$result_dao->id][$returnName] = $result_dao->$alias;
         }
         // Backward compatibility on fields names.
-        if ($this->isFillUniqueFields && !empty($this->apiFieldSpec[$column]['uniqueName'])) {
-          $result_entities[$result_dao->id][$this->apiFieldSpec[$column]['uniqueName']] = $result_dao->$alias;
+        if ($this->isFillUniqueFields && !empty($this->apiFieldSpec[$alias]['uniqueName'])) {
+          $result_entities[$result_dao->id][$this->apiFieldSpec[$alias]['uniqueName']] = $result_dao->$alias;
         }
         foreach ($this->apiFieldSpec as $returnName => $spec) {
           if (empty($result_entities[$result_dao->id][$returnName]) && !empty($result_entities[$result_dao->id][$spec['name']])) {