mirror of
https://github.com/shlinkio/shlink.git
synced 2025-02-25 18:45:27 -06:00
Added support to dispatch async event listeners as RoadRunner jobs
This commit is contained in:
@@ -5,8 +5,9 @@ declare(strict_types=1);
|
||||
namespace Shlinkio\Shlink\Core\EventDispatcher\Event;
|
||||
|
||||
use JsonSerializable;
|
||||
use Shlinkio\Shlink\EventDispatcher\Util\JsonUnserializable;
|
||||
|
||||
abstract class AbstractVisitEvent implements JsonSerializable
|
||||
abstract class AbstractVisitEvent implements JsonSerializable, JsonUnserializable
|
||||
{
|
||||
public function __construct(public readonly string $visitId)
|
||||
{
|
||||
@@ -16,4 +17,9 @@ abstract class AbstractVisitEvent implements JsonSerializable
|
||||
{
|
||||
return ['visitId' => $this->visitId];
|
||||
}
|
||||
|
||||
public static function fromPayload(array $payload): self
|
||||
{
|
||||
return new static($payload['visitId'] ?? '');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,9 @@ declare(strict_types=1);
|
||||
namespace Shlinkio\Shlink\Core\EventDispatcher\Event;
|
||||
|
||||
use JsonSerializable;
|
||||
use Shlinkio\Shlink\EventDispatcher\Util\JsonUnserializable;
|
||||
|
||||
final class ShortUrlCreated implements JsonSerializable
|
||||
final class ShortUrlCreated implements JsonSerializable, JsonUnserializable
|
||||
{
|
||||
public function __construct(public readonly string $shortUrlId)
|
||||
{
|
||||
@@ -18,4 +19,9 @@ final class ShortUrlCreated implements JsonSerializable
|
||||
'shortUrlId' => $this->shortUrlId,
|
||||
];
|
||||
}
|
||||
|
||||
public static function fromPayload(array $payload): self
|
||||
{
|
||||
return new self($payload['shortUrlId'] ?? '');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user