From 7a4a2f65198596528bd85ed41965c80bc3769805 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Wed, 26 May 2021 16:05:15 -0700 Subject: [PATCH] (REF) CRM_Api4_Services - Switch to EventScanner --- CRM/Api4/Services.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/CRM/Api4/Services.php b/CRM/Api4/Services.php index 47b4284031..fe88674de4 100644 --- a/CRM/Api4/Services.php +++ b/CRM/Api4/Services.php @@ -16,7 +16,7 @@ * @copyright CiviCRM LLC https://civicrm.org/licensing */ - +use Civi\Core\Event\EventScanner; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; use Symfony\Component\Config\FileLocator; @@ -43,11 +43,8 @@ class CRM_Api4_Services { $subscribers = $container->findTaggedServiceIds('event_subscriber'); foreach (array_keys($subscribers) as $subscriber) { - $getSubscribedEvents = [$container->findDefinition($subscriber)->getClass(), 'getSubscribedEvents']; - $dispatcher->addMethodCall( - 'addSubscriberServiceMap', - [$subscriber, $getSubscribedEvents()] - ); + $listenerMap = EventScanner::findListeners($container->findDefinition($subscriber)->getClass()); + $dispatcher->addMethodCall('addSubscriberServiceMap', [$subscriber, $listenerMap]); } // add spec providers -- 2.25.1