3737use OCA \WorkflowEngine \Service \RuleMatcher ;
3838use OCP \AppFramework \QueryException ;
3939use OCP \DB \QueryBuilder \IQueryBuilder ;
40+ use OCP \EventDispatcher \IEventDispatcher ;
4041use OCP \Files \Storage \IStorage ;
4142use OCP \IDBConnection ;
4243use OCP \IL10N ;
4344use OCP \ILogger ;
4445use OCP \IServerContainer ;
4546use OCP \IUserSession ;
47+ use OCP \WorkflowEngine \Events \RegisterChecksEvent ;
48+ use OCP \WorkflowEngine \Events \RegisterEntitiesEvent ;
49+ use OCP \WorkflowEngine \Events \RegisterOperationsEvent ;
4650use OCP \WorkflowEngine \ICheck ;
4751use OCP \WorkflowEngine \IComplexOperation ;
4852use OCP \WorkflowEngine \IEntity ;
4953use OCP \WorkflowEngine \IEntityEvent ;
5054use OCP \WorkflowEngine \IManager ;
5155use OCP \WorkflowEngine \IOperation ;
5256use OCP \WorkflowEngine \IRuleMatcher ;
53- use Symfony \Component \EventDispatcher \EventDispatcherInterface ;
57+ use Symfony \Component \EventDispatcher \EventDispatcherInterface as LegacyDispatcher ;
5458use Symfony \Component \EventDispatcher \GenericEvent ;
5559
5660class Manager implements IManager {
@@ -79,8 +83,8 @@ class Manager implements IManager {
7983 /** @var IL10N */
8084 protected $ l ;
8185
82- /** @var EventDispatcherInterface */
83- protected $ eventDispatcher ;
86+ /** @var LegacyDispatcher */
87+ protected $ legacyEventDispatcher ;
8488
8589 /** @var IEntity[] */
8690 protected $ registeredEntities = [];
@@ -100,26 +104,26 @@ class Manager implements IManager {
100104 /** @var IUserSession */
101105 protected $ session ;
102106
103- /**
104- * @param IDBConnection $connection
105- * @param IServerContainer $container
106- * @param IL10N $l
107- */
107+ /** @var IEventDispatcher */
108+ private $ dispatcher ;
109+
108110 public function __construct (
109111 IDBConnection $ connection ,
110112 IServerContainer $ container ,
111113 IL10N $ l ,
112- EventDispatcherInterface $ eventDispatcher ,
114+ LegacyDispatcher $ eventDispatcher ,
113115 ILogger $ logger ,
114- IUserSession $ session
116+ IUserSession $ session ,
117+ IEventDispatcher $ dispatcher
115118 ) {
116119 $ this ->connection = $ connection ;
117120 $ this ->container = $ container ;
118121 $ this ->l = $ l ;
119- $ this ->eventDispatcher = $ eventDispatcher ;
122+ $ this ->legacyEventDispatcher = $ eventDispatcher ;
120123 $ this ->logger = $ logger ;
121124 $ this ->operationsByScope = new CappedMemoryCache (64 );
122125 $ this ->session = $ session ;
126+ $ this ->dispatcher = $ dispatcher ;
123127 }
124128
125129 public function getRuleMatcher (): IRuleMatcher {
@@ -606,7 +610,8 @@ public function formatOperation(array $operation): array {
606610 * @return IEntity[]
607611 */
608612 public function getEntitiesList (): array {
609- $ this ->eventDispatcher ->dispatch (IManager::EVENT_NAME_REG_ENTITY , new GenericEvent ($ this ));
613+ $ this ->dispatcher ->dispatchTyped (new RegisterEntitiesEvent ($ this ));
614+ $ this ->legacyEventDispatcher ->dispatch (IManager::EVENT_NAME_REG_ENTITY , new GenericEvent ($ this ));
610615
611616 return array_values (array_merge ($ this ->getBuildInEntities (), $ this ->registeredEntities ));
612617 }
@@ -615,7 +620,8 @@ public function getEntitiesList(): array {
615620 * @return IOperation[]
616621 */
617622 public function getOperatorList (): array {
618- $ this ->eventDispatcher ->dispatch (IManager::EVENT_NAME_REG_OPERATION , new GenericEvent ($ this ));
623+ $ this ->dispatcher ->dispatchTyped (new RegisterOperationsEvent ($ this ));
624+ $ this ->legacyEventDispatcher ->dispatch (IManager::EVENT_NAME_REG_OPERATION , new GenericEvent ($ this ));
619625
620626 return array_merge ($ this ->getBuildInOperators (), $ this ->registeredOperators );
621627 }
@@ -624,7 +630,8 @@ public function getOperatorList(): array {
624630 * @return ICheck[]
625631 */
626632 public function getCheckList (): array {
627- $ this ->eventDispatcher ->dispatch (IManager::EVENT_NAME_REG_CHECK , new GenericEvent ($ this ));
633+ $ this ->dispatcher ->dispatchTyped (new RegisterChecksEvent ($ this ));
634+ $ this ->legacyEventDispatcher ->dispatch (IManager::EVENT_NAME_REG_CHECK , new GenericEvent ($ this ));
628635
629636 return array_merge ($ this ->getBuildInChecks (), $ this ->registeredChecks );
630637 }
0 commit comments