getServiceManager()->get(EventManager::SERVICE_ID); $eventManager->attach(ClassPropertiesChangedEvent::class, [ClassPropertiesChangedListener::SERVICE_ID, 'handleEvent']); $eventManager->attach(ClassPropertyRemovedEvent::class, [ClassPropertyRemovedListener::SERVICE_ID, 'handleEvent']); $eventManager->attach(DataAccessControlChangedEvent::class, [DataAccessControlChangedListener::SERVICE_ID, 'handleEvent']); $this->getServiceManager()->register(EventManager::SERVICE_ID, $eventManager); $this->getServiceManager()->register(ClassPropertiesChangedListener::SERVICE_ID, new ClassPropertiesChangedListener()); $this->getServiceManager()->register(ClassPropertyRemovedListener::SERVICE_ID, new ClassPropertyRemovedListener()); $this->getServiceManager()->register(DataAccessControlChangedListener::SERVICE_ID, new DataAccessControlChangedListener()); $this->getServiceManager()->register(IndexUpdaterInterface::SERVICE_ID, new GenerisIndexUpdater()); $this->getServiceManager()->register( IndexService::SERVICE_ID, new IndexService( [ 'documentBuilder' => new IndexDocumentBuilder() ] ) ); } public function down(Schema $schema): void { $this->getServiceManager()->unregister(ClassPropertiesChangedListener::SERVICE_ID); $this->getServiceManager()->unregister(ClassPropertiesChangedListener::SERVICE_ID); $this->getServiceManager()->unregister(DataAccessControlChangedListener::SERVICE_ID); /** @var EventManager $eventManager */ $eventManager = $this->getServiceManager()->get(EventManager::SERVICE_ID); $eventManager->detach(ClassPropertiesChangedEvent::class, [ClassPropertiesChangedListener::SERVICE_ID, 'handleEvent']); $eventManager->detach(ClassPropertyRemovedEvent::class, [ClassPropertyRemovedListener::SERVICE_ID, 'handleEvent']); $eventManager->detach(DataAccessControlChangedEvent::class, [DataAccessControlChangedListener::SERVICE_ID, 'handleEvent']); $this->getServiceManager()->register(EventManager::SERVICE_ID, $eventManager); $this->getServiceManager()->unregister(IndexUpdaterInterface::SERVICE_ID); $this->getServiceManager()->unregister(IndexService::SERVICE_ID); } }