diff --git a/lib/Alchemy/Phrasea/Application.php b/lib/Alchemy/Phrasea/Application.php index 08b96eb888..13c7728f86 100644 --- a/lib/Alchemy/Phrasea/Application.php +++ b/lib/Alchemy/Phrasea/Application.php @@ -88,7 +88,6 @@ use Alchemy\Phrasea\Media\PermalinkMediaResolver; use Alchemy\Phrasea\Media\TechnicalDataServiceProvider; use Alchemy\Phrasea\Model\Entities\User; use Alchemy\QueueProvider\QueueServiceProvider; -use Alchemy\Phrasea\Core\Event\Subscriber\WebhookSubdefEventSubscriber; use Alchemy\WorkerProvider\WorkerServiceProvider; use Doctrine\DBAL\Event\ConnectionEventArgs; use MediaVorus\Media\MediaInterface; @@ -743,7 +742,6 @@ class Application extends SilexApplication $dispatcher->addSubscriber(new LazaretSubscriber($app)); $dispatcher->addSubscriber(new ValidationSubscriber($app)); $dispatcher->addSubscriber(new WebhookUserEventSubscriber($app)); - $dispatcher->addSubscriber(new WebhookSubdefEventSubscriber($app['manipulator.webhook-event'])); return $dispatcher; }) diff --git a/lib/Alchemy/Phrasea/Core/Provider/WebhookServiceProvider.php b/lib/Alchemy/Phrasea/Core/Provider/WebhookServiceProvider.php index 4b280c92f0..968ec607e1 100644 --- a/lib/Alchemy/Phrasea/Core/Provider/WebhookServiceProvider.php +++ b/lib/Alchemy/Phrasea/Core/Provider/WebhookServiceProvider.php @@ -2,6 +2,7 @@ namespace Alchemy\Phrasea\Core\Provider; +use Alchemy\Phrasea\Core\Event\Subscriber\WebhookSubdefEventSubscriber; use Alchemy\Phrasea\Webhook\EventProcessorFactory; use Alchemy\Phrasea\Webhook\EventProcessorWorker; use Alchemy\Phrasea\Webhook\WebhookInvoker; @@ -10,6 +11,7 @@ use Alchemy\Worker\CallableWorkerFactory; use Alchemy\Worker\TypeBasedWorkerResolver; use Silex\Application; use Silex\ServiceProviderInterface; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; class WebhookServiceProvider implements ServiceProviderInterface { @@ -69,6 +71,12 @@ class WebhookServiceProvider implements ServiceProviderInterface public function boot(Application $app) { - // no-op + $app['dispatcher'] = $app->share( + $app->extend('dispatcher', function (EventDispatcherInterface $dispatcher) use ($app) { + $dispatcher->addSubscriber(new WebhookSubdefEventSubscriber($app['manipulator.webhook-event'])); + + return $dispatcher; + }) + ); } }