Merge pull request #18084 from civicrm/5.28
[civicrm-core.git] / Civi / Api4 / Provider / ActionObjectProvider.php
index b31c3d323f9ab997d181928bcf25cfbdb75563af..ced568e7b795b5c48957b8829515b247476f6450 100644 (file)
@@ -31,7 +31,7 @@ class ActionObjectProvider implements EventSubscriberInterface, ProviderInterfac
     // to override standard implementations -- which is
     // handy for testing/mocking.
     return [
-      Events::RESOLVE => [
+      'civi.api.resolve' => [
         ['onApiResolve', Events::W_EARLY],
       ],
     ];
@@ -116,7 +116,8 @@ class ActionObjectProvider implements EventSubscriberInterface, ProviderInterfac
       }
     }
     elseif (is_string($val) && strlen($val) > 1 && substr($val, 0, 1) === '$') {
-      $val = \CRM_Utils_Array::pathGet($result, explode('.', substr($val, 1)));
+      $key = substr($val, 1);
+      $val = $result[$key] ?? \CRM_Utils_Array::pathGet($result, explode('.', $key));
     }
   }