Skip to content

Commit

Permalink
Register subscribers via tags for greater extensibility
Browse files Browse the repository at this point in the history
  • Loading branch information
flack committed May 16, 2024
1 parent f1fbfbd commit aff37b4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/midcom/bundle/config/services.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
services:
subscriber:
class: midcom\httpkernel\subscriber
tags:
- {name: 'kernel.event_subscriber'}

watcher:
class: midcom\events\watcher
arguments: ['@componentloader']
tags:
- {name: 'kernel.event_subscriber'}

event_dispatcher:
class: Symfony\Component\EventDispatcher\EventDispatcher
calls:
- [addSubscriber, ['@subscriber']]
- [addSubscriber, ['@watcher']]
- [addSubscriber, ['@cache']]
- [addSubscriber, ['@head']]

dispatcher:
alias: event_dispatcher
Expand Down Expand Up @@ -69,6 +68,8 @@ services:
cache:
class: midcom_services_cache
public: true
tags:
- {name: 'kernel.event_subscriber'}

cache.module.content:
class: midcom_services_cache_module_content
Expand Down Expand Up @@ -119,6 +120,8 @@ services:
head:
class: midcom_helper_head
public: true
tags:
- {name: 'kernel.event_subscriber'}

i18n:
class: midcom_services_i18n
Expand Down
2 changes: 2 additions & 0 deletions src/midcom/bundle/midcomBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use midcom\bundle\dependencyInjection\cachePass;
use midcom\bundle\dependencyInjection\indexerPass;
use midcom\bundle\dependencyInjection\authPass;
use Symfony\Component\EventDispatcher\DependencyInjection\RegisterListenersPass;

class midcomBundle extends Bundle
{
Expand All @@ -37,5 +38,6 @@ public function build(ContainerBuilder $container)
$container->addCompilerPass(new FormPass);
$container->addCompilerPass(new datamanagerPass);
$container->addCompilerPass(new AddConsoleCommandPass);
$container->addCompilerPass(new RegisterListenersPass);
}
}

0 comments on commit aff37b4

Please sign in to comment.