mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 09:53:15 +00:00
fix
This commit is contained in:
@@ -7,19 +7,16 @@ use Alchemy\Phrasea\Core\Event\Record\SubDefinitionCreatedEvent;
|
||||
use Alchemy\Phrasea\Core\Event\Record\SubDefinitionCreationFailedEvent;
|
||||
use Alchemy\Phrasea\Core\Event\Record\SubDefinitionsCreatedEvent;
|
||||
use Alchemy\Phrasea\Model\Entities\WebhookEvent;
|
||||
use Alchemy\Phrasea\Model\Manipulator\WebhookEventManipulator;
|
||||
use Silex\Application;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
|
||||
class WebhookSubdefEventSubscriber implements EventSubscriberInterface
|
||||
{
|
||||
/**
|
||||
* @var WebhookEventManipulator
|
||||
*/
|
||||
private $webhookManipulator;
|
||||
private $app;
|
||||
|
||||
public function __construct(WebhookEventManipulator $manipulator)
|
||||
public function __construct(Application $app)
|
||||
{
|
||||
$this->webhookManipulator = $manipulator;
|
||||
$this->app = $app;
|
||||
}
|
||||
|
||||
public function onSubdefCreated(SubDefinitionCreatedEvent $event)
|
||||
@@ -30,7 +27,7 @@ class WebhookSubdefEventSubscriber implements EventSubscriberInterface
|
||||
'subdef' => $event->getSubDefinitionName()
|
||||
];
|
||||
|
||||
$this->webhookManipulator->create(
|
||||
$this->app['manipulator.webhook-event']->create(
|
||||
WebhookEvent::RECORD_SUBDEF_CREATED,
|
||||
WebhookEvent::RECORD_SUBDEF_TYPE,
|
||||
$eventData
|
||||
@@ -45,7 +42,7 @@ class WebhookSubdefEventSubscriber implements EventSubscriberInterface
|
||||
'subdef' => $event->getSubDefinitionName()
|
||||
];
|
||||
|
||||
$this->webhookManipulator->create(
|
||||
$this->app['manipulator.webhook-event']->create(
|
||||
WebhookEvent::RECORD_SUBDEF_FAILED,
|
||||
WebhookEvent::RECORD_SUBDEF_TYPE,
|
||||
$eventData
|
||||
@@ -60,7 +57,7 @@ class WebhookSubdefEventSubscriber implements EventSubscriberInterface
|
||||
'subdef_count' => count($event->getMedia())
|
||||
];
|
||||
|
||||
$this->webhookManipulator->create(
|
||||
$this->app['manipulator.webhook-event']->create(
|
||||
WebhookEvent::RECORD_SUBDEFS_CREATED,
|
||||
WebhookEvent::RECORD_SUBDEF_TYPE,
|
||||
$eventData
|
||||
|
@@ -11,7 +11,7 @@ use Alchemy\Worker\CallableWorkerFactory;
|
||||
use Alchemy\Worker\TypeBasedWorkerResolver;
|
||||
use Silex\Application;
|
||||
use Silex\ServiceProviderInterface;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
|
||||
class WebhookServiceProvider implements ServiceProviderInterface
|
||||
{
|
||||
@@ -60,6 +60,14 @@ class WebhookServiceProvider implements ServiceProviderInterface
|
||||
return $resolver;
|
||||
}
|
||||
);
|
||||
|
||||
$app['dispatcher'] = $app->share(
|
||||
$app->extend('dispatcher', function (EventDispatcher $dispatcher, Application $app) {
|
||||
$dispatcher->addSubscriber(new WebhookSubdefEventSubscriber($app));
|
||||
|
||||
return $dispatcher;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
private function createAlias(Application $app, $alias, $targetServiceKey)
|
||||
@@ -71,12 +79,6 @@ class WebhookServiceProvider implements ServiceProviderInterface
|
||||
|
||||
public function boot(Application $app)
|
||||
{
|
||||
$app['dispatcher'] = $app->share(
|
||||
$app->extend('dispatcher', function (EventDispatcherInterface $dispatcher) use ($app) {
|
||||
$dispatcher->addSubscriber(new WebhookSubdefEventSubscriber($app['manipulator.webhook-event']));
|
||||
|
||||
return $dispatcher;
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user