From cceb76412ae162ea79025e2e9d8fd7f64af50c97 Mon Sep 17 00:00:00 2001 From: Jens Schuppe Date: Fri, 15 Oct 2021 14:23:51 +0200 Subject: [PATCH] Load the API kernel service prior to dispatching the `civi.api4.createRequest` event when creating an API4 request --- Civi/API/Request.php | 4 ++++ 1 file changed, 4 insertions(+) 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]; -- 2.25.1