aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/event
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2013-11-13 17:34:06 +0100
committerJoas Schilling <nickvergessen@gmx.de>2013-11-13 17:34:06 +0100
commitd3f9a51709d538824f4ec7afe8a2d6934dabb13c (patch)
tree75ae54e57a27ebc8ce8dcb95ee53fafaecbc01cd /phpBB/phpbb/event
parentcfb0a4103083c4787beca30671d16eede92bd571 (diff)
downloadforums-d3f9a51709d538824f4ec7afe8a2d6934dabb13c.tar
forums-d3f9a51709d538824f4ec7afe8a2d6934dabb13c.tar.gz
forums-d3f9a51709d538824f4ec7afe8a2d6934dabb13c.tar.bz2
forums-d3f9a51709d538824f4ec7afe8a2d6934dabb13c.tar.xz
forums-d3f9a51709d538824f4ec7afe8a2d6934dabb13c.zip
[ticket/12016] Use a service provider for event listeners
This allows them to use dependency injection PHPBB3-12016
Diffstat (limited to 'phpBB/phpbb/event')
-rw-r--r--phpBB/phpbb/event/extension_subscriber_loader.php20
1 files changed, 8 insertions, 12 deletions
diff --git a/phpBB/phpbb/event/extension_subscriber_loader.php b/phpBB/phpbb/event/extension_subscriber_loader.php
index df8e093f4a..6408f93e2a 100644
--- a/phpBB/phpbb/event/extension_subscriber_loader.php
+++ b/phpBB/phpbb/event/extension_subscriber_loader.php
@@ -14,26 +14,22 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
class extension_subscriber_loader
{
private $dispatcher;
- private $extension_manager;
+ private $listener_collection;
- public function __construct(EventDispatcherInterface $dispatcher, \phpbb\extension\manager $extension_manager)
+ public function __construct(EventDispatcherInterface $dispatcher, \phpbb\di\service_collection $listener_collection)
{
$this->dispatcher = $dispatcher;
- $this->extension_manager = $extension_manager;
+ $this->listener_collection = $listener_collection;
}
public function load()
{
- $finder = $this->extension_manager->get_finder();
- $subscriber_classes = $finder
- ->extension_directory('/event')
- ->core_path('event/')
- ->get_classes();
-
- foreach ($subscriber_classes as $class)
+ if (!empty($this->listener_collection))
{
- $subscriber = new $class();
- $this->dispatcher->addSubscriber($subscriber);
+ foreach ($this->listener_collection as $listener)
+ {
+ $this->dispatcher->addSubscriber($listener);
+ }
}
}
}