From: Jens Schuppe Date: Fri, 15 Oct 2021 12:23:51 +0000 (+0200) Subject: Load the API kernel service prior to dispatching the `civi.api4.createRequest` event... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=cceb76412ae162ea79025e2e9d8fd7f64af50c97;p=civicrm-core.git Load the API kernel service prior to dispatching the `civi.api4.createRequest` event when creating an API4 request --- diff --git a/Civi/API/Request.php b/Civi/API/Request.php index 4c9a6d5fc0..65d5c28035 100644 --- a/Civi/API/Request.php +++ b/Civi/API/Request.php @@ -45,6 +45,10 @@ class Request { ]; case 4: + // Load the API kernel service for registering API providers, as + // otherwise subscribers to the civi.api4.createRequest event registered + // through the EventSubscriberInterface will not be registered. + $kernel = \Civi::service('civi_api_kernel'); $e = new CreateApi4RequestEvent($entity); \Civi::dispatcher()->dispatch('civi.api4.createRequest', $e); $callable = [$e->className, $action];