diff --git a/Civi/Api4/Service/Spec/SpecGatherer.php b/Civi/Api4/Service/Spec/SpecGatherer.php index f9369d75abc4..eee3974134f5 100644 --- a/Civi/Api4/Service/Spec/SpecGatherer.php +++ b/Civi/Api4/Service/Spec/SpecGatherer.php @@ -159,10 +159,13 @@ private function getCustomGroupFields($customGroup, RequestSpec $specification) * @param string $entityName * * @return array + * @throws \API_Exception */ - private function getDAOFields($entityName) { + private function getDAOFields(string $entityName): array { $bao = CoreUtil::getBAOFromApiName($entityName); - + if (!$bao) { + throw new \API_Exception('Entity not loaded' . $entityName); + } return $bao::getSupportedFields(); }