CRM_Core_DAO - Throw clearer error message about pseudoconstants
authorTim Otten <totten@civicrm.org>
Mon, 3 Jun 2013 02:41:12 +0000 (22:41 -0400)
committerTim Otten <totten@civicrm.org>
Mon, 3 Jun 2013 02:41:12 +0000 (22:41 -0400)
CRM/Core/DAO.php

index ecf28df3fc1cc91a19045eda56b605c0f0dbdb8a..f37b8d3e1675c948ce092b343876a33bb010c37e 100644 (file)
@@ -1325,6 +1325,9 @@ SELECT contact_id
           }
           $constant = CRM_Utils_Array::value('pseudoconstant', $value);
           if (!empty($constant)) {
+            if (empty($constant['name'])) {
+              throw new CRM_Core_Exception("Failed to choose value for $daoName ($name) -- missing pseudo-constant name");
+            }
             $constantValues = CRM_Utils_PseudoConstant::getConstant($constant['name']);
             if (!empty($constantValues)) {
               $constantOptions = array_keys($constantValues);