APIv4 GetFields - Ignore invalid fields rather than fatal error in getFields action
authorColeman Watts <coleman@civicrm.org>
Thu, 19 May 2022 00:01:52 +0000 (20:01 -0400)
committerColeman Watts <coleman@civicrm.org>
Sat, 21 May 2022 01:30:43 +0000 (21:30 -0400)
Civi/Api4/Generic/DAOGetFieldsAction.php

index e877e6dd8b2b852bc0ff654167fb76fce3386b81..77a97e82ec066288d48e2e1b219993cea3530f3d 100644 (file)
@@ -111,7 +111,7 @@ class DAOGetFieldsAction extends BasicGetFieldsAction {
           throw new \API_Exception('Illegal expression');
         }
         $baoName = CoreUtil::getBAOFromApiName($this->getEntityName());
-        $options = $baoName::buildOptions($fieldName, $context);
+        $options = $baoName::buildOptions($fieldName, $context) ?: [];
         $this->values[$fieldName] = FormattingUtil::replacePseudoconstant($options, $this->values[$key], TRUE);
         unset($this->values[$key]);
       }