initialize webhook with worker

This commit is contained in:
aynsix
2019-09-20 16:55:03 +04:00
parent 65d7affcb5
commit 9aaf66dd7c
3 changed files with 14 additions and 4 deletions

View File

@@ -12,7 +12,7 @@
namespace Alchemy\Phrasea\Model\Manipulator; namespace Alchemy\Phrasea\Model\Manipulator;
use Alchemy\Phrasea\Model\Entities\WebhookEvent; use Alchemy\Phrasea\Model\Entities\WebhookEvent;
use Alchemy\Phrasea\Webhook\WebhookPublisher; use Alchemy\Phrasea\Webhook\WebhookPublisherInterface;
use Doctrine\Common\Persistence\ObjectManager; use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\EntityRepository; use Doctrine\ORM\EntityRepository;
@@ -29,11 +29,11 @@ class WebhookEventManipulator implements ManipulatorInterface
private $repository; private $repository;
/** /**
* @var WebhookPublisher * @var WebhookPublisherInterface
*/ */
private $publisher; private $publisher;
public function __construct(ObjectManager $om, EntityRepository $repo, WebhookPublisher $publisher) public function __construct(ObjectManager $om, EntityRepository $repo, WebhookPublisherInterface $publisher)
{ {
$this->om = $om; $this->om = $om;
$this->repository = $repo; $this->repository = $repo;

View File

@@ -19,7 +19,7 @@ use Alchemy\Queue\MessageQueueRegistry;
* Class WebhookPublisher publishes webhook event notifications in message queues * Class WebhookPublisher publishes webhook event notifications in message queues
* @package Alchemy\Phrasea\Webhook * @package Alchemy\Phrasea\Webhook
*/ */
class WebhookPublisher class WebhookPublisher implements WebhookPublisherInterface
{ {
/** /**
* @var MessageQueueRegistry * @var MessageQueueRegistry

View File

@@ -0,0 +1,10 @@
<?php
namespace Alchemy\Phrasea\Webhook;
use Alchemy\Phrasea\Model\Entities\WebhookEvent;
interface WebhookPublisherInterface
{
public function publishWebhookEvent(WebhookEvent $event);
}