mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
N°4756 - Ease extensibility for CRUD operations : Event Service - renamed service setup interface
This commit is contained in:
@@ -6,9 +6,9 @@
|
||||
*/
|
||||
|
||||
use Combodo\iTop\Service\EventService;
|
||||
use Combodo\iTop\Service\iEventEnrolment;
|
||||
use Combodo\iTop\Service\iEventServiceSetup;
|
||||
|
||||
class ApplicationEvents implements iEventEnrolment
|
||||
class ApplicationEvents implements iEventServiceSetup
|
||||
{
|
||||
// Startup events
|
||||
const APPLICATION_EVENT_REQUEST_RECEIVED = 'APPLICATION_EVENT_REQUEST_RECEIVED';
|
||||
@@ -17,7 +17,7 @@ class ApplicationEvents implements iEventEnrolment
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function InitEvents()
|
||||
public function RegisterEventsAndListeners()
|
||||
{
|
||||
EventService::RegisterEvent(self::APPLICATION_EVENT_REQUEST_RECEIVED, [
|
||||
'description' => 'A request was received from the network, at this point only the session is started, the configuration is not even loaded',
|
||||
|
||||
@@ -145,6 +145,10 @@ return array(
|
||||
'CAS_Request_Exception' => $vendorDir . '/apereo/phpcas/source/CAS/Request/Exception.php',
|
||||
'CAS_Request_MultiRequestInterface' => $vendorDir . '/apereo/phpcas/source/CAS/Request/MultiRequestInterface.php',
|
||||
'CAS_Request_RequestInterface' => $vendorDir . '/apereo/phpcas/source/CAS/Request/RequestInterface.php',
|
||||
'CAS_ServiceBaseUrl_AllowedListDiscovery' => $vendorDir . '/apereo/phpcas/source/CAS/ServiceBaseUrl/AllowedListDiscovery.php',
|
||||
'CAS_ServiceBaseUrl_Base' => $vendorDir . '/apereo/phpcas/source/CAS/ServiceBaseUrl/Base.php',
|
||||
'CAS_ServiceBaseUrl_Interface' => $vendorDir . '/apereo/phpcas/source/CAS/ServiceBaseUrl/Interface.php',
|
||||
'CAS_ServiceBaseUrl_Static' => $vendorDir . '/apereo/phpcas/source/CAS/ServiceBaseUrl/Static.php',
|
||||
'CAS_Session_PhpSession' => $vendorDir . '/apereo/phpcas/source/CAS/Session/PhpSession.php',
|
||||
'CAS_TypeMismatchException' => $vendorDir . '/apereo/phpcas/source/CAS/TypeMismatchException.php',
|
||||
'CLILikeWebPage' => $baseDir . '/sources/Application/WebPage/CLILikeWebPage.php',
|
||||
@@ -427,7 +431,7 @@ return array(
|
||||
'Combodo\\iTop\\Service\\EventData' => $baseDir . '/sources/Application/Service/EventData.php',
|
||||
'Combodo\\iTop\\Service\\EventHelper' => $baseDir . '/sources/Application/Service/EventHelper.php',
|
||||
'Combodo\\iTop\\Service\\EventService' => $baseDir . '/sources/Application/Service/EventService.php',
|
||||
'Combodo\\iTop\\Service\\iEventEnrolment' => $baseDir . '/sources/Application/Service/iEventEnrolment.php',
|
||||
'Combodo\\iTop\\Service\\iEventServiceSetup' => $baseDir . '/sources/Application/Service/iEventServiceSetup.php',
|
||||
'CompileCSSService' => $baseDir . '/application/compilecssservice.class.inc.php',
|
||||
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
|
||||
'Config' => $baseDir . '/core/config.class.inc.php',
|
||||
|
||||
@@ -510,6 +510,10 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
|
||||
'CAS_Request_Exception' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/Request/Exception.php',
|
||||
'CAS_Request_MultiRequestInterface' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/Request/MultiRequestInterface.php',
|
||||
'CAS_Request_RequestInterface' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/Request/RequestInterface.php',
|
||||
'CAS_ServiceBaseUrl_AllowedListDiscovery' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/ServiceBaseUrl/AllowedListDiscovery.php',
|
||||
'CAS_ServiceBaseUrl_Base' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/ServiceBaseUrl/Base.php',
|
||||
'CAS_ServiceBaseUrl_Interface' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/ServiceBaseUrl/Interface.php',
|
||||
'CAS_ServiceBaseUrl_Static' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/ServiceBaseUrl/Static.php',
|
||||
'CAS_Session_PhpSession' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/Session/PhpSession.php',
|
||||
'CAS_TypeMismatchException' => __DIR__ . '/..' . '/apereo/phpcas/source/CAS/TypeMismatchException.php',
|
||||
'CLILikeWebPage' => __DIR__ . '/../..' . '/sources/Application/WebPage/CLILikeWebPage.php',
|
||||
@@ -792,7 +796,7 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
|
||||
'Combodo\\iTop\\Service\\EventData' => __DIR__ . '/../..' . '/sources/Application/Service/EventData.php',
|
||||
'Combodo\\iTop\\Service\\EventHelper' => __DIR__ . '/../..' . '/sources/Application/Service/EventHelper.php',
|
||||
'Combodo\\iTop\\Service\\EventService' => __DIR__ . '/../..' . '/sources/Application/Service/EventService.php',
|
||||
'Combodo\\iTop\\Service\\iEventEnrolment' => __DIR__ . '/../..' . '/sources/Application/Service/iEventEnrolment.php',
|
||||
'Combodo\\iTop\\Service\\iEventServiceSetup' => __DIR__ . '/../..' . '/sources/Application/Service/iEventServiceSetup.php',
|
||||
'CompileCSSService' => __DIR__ . '/../..' . '/application/compilecssservice.class.inc.php',
|
||||
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
|
||||
'Config' => __DIR__ . '/../..' . '/core/config.class.inc.php',
|
||||
|
||||
@@ -16,7 +16,7 @@ use utils;
|
||||
|
||||
class EventService
|
||||
{
|
||||
public static $aEventListeners = [];
|
||||
private static $aEventListeners = [];
|
||||
private static $iEventIdCounter = 0;
|
||||
private static $aEventDescription = [];
|
||||
|
||||
@@ -26,11 +26,11 @@ class EventService
|
||||
self::$iEventIdCounter = 0;
|
||||
self::$aEventDescription = [];
|
||||
|
||||
$aEventEnrolments = utils::GetClassesForInterface(iEventEnrolment::class);
|
||||
foreach ($aEventEnrolments as $sEventEnrolmentClass) {
|
||||
/** @var \Combodo\iTop\Service\iEventEnrolment $oEventEnrolment */
|
||||
$oEventEnrolment = new $sEventEnrolmentClass();
|
||||
$oEventEnrolment->InitEvents();
|
||||
$aEventServiceSetup = utils::GetClassesForInterface(iEventServiceSetup::class);
|
||||
foreach ($aEventServiceSetup as $sEventServiceSetupClass) {
|
||||
/** @var \Combodo\iTop\Service\iEventServiceSetup $oEventServiceSetup */
|
||||
$oEventServiceSetup = new $sEventServiceSetupClass();
|
||||
$oEventServiceSetup->RegisterEventsAndListeners();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,11 +6,16 @@
|
||||
|
||||
namespace Combodo\iTop\Service;
|
||||
|
||||
interface iEventEnrolment
|
||||
/**
|
||||
* Interface to implement in order to register the events and listeners
|
||||
*
|
||||
* @since 3.1.0
|
||||
*/
|
||||
interface iEventServiceSetup
|
||||
{
|
||||
/**
|
||||
* Extension point to register the events and events listeners
|
||||
* @return void
|
||||
*/
|
||||
public function InitEvents();
|
||||
public function RegisterEventsAndListeners();
|
||||
}
|
||||
Reference in New Issue
Block a user