Adding EventDispatcher to IServerContainer

This commit is contained in:
Thomas Müller 2015-08-14 15:40:15 +02:00
parent ddc7f668e5
commit 0b64268910
2 changed files with 24 additions and 2 deletions

View File

@ -51,7 +51,6 @@ use OC\Http\Client\ClientService;
use OC\Lock\MemcacheLockingProvider;
use OC\Lock\NoopLockingProvider;
use OC\Mail\Mailer;
use OC\Memcache\NullCache;
use OC\Security\CertificateManager;
use OC\Security\Crypto;
use OC\Security\Hasher;
@ -59,6 +58,8 @@ use OC\Security\SecureRandom;
use OC\Security\TrustedDomainHelper;
use OC\Tagging\TagMapper;
use OCP\IServerContainer;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
/**
* Class Server
@ -457,7 +458,9 @@ class Server extends SimpleContainer implements IServerContainer {
});
return $manager;
});
$this->registerService('EventDispatcher', function() {
return new EventDispatcher();
});
}
/**
@ -963,4 +966,14 @@ class Server extends SimpleContainer implements IServerContainer {
public function getCapabilitiesManager() {
return $this->query('CapabilitiesManager');
}
/**
* Get the EventDispatcher
*
* @return EventDispatcherInterface
* @since 8.2.0
*/
public function getEventDispatcher() {
return $this->query('EventDispatcher');
}
}

View File

@ -39,6 +39,7 @@
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
/**
@ -439,4 +440,12 @@ interface IServerContainer {
*/
public function getMimeTypeDetector();
/**
* Get the EventDispatcher
*
* @return EventDispatcherInterface
* @since 8.2.0
*/
public function getEventDispatcher();
}