feat: add SendNotifWatchListTrigger Message

This commit is contained in:
Maël Gangloff
2024-07-21 00:56:27 +02:00
parent 86aa1d2f3f
commit 17a1cc2938
8 changed files with 115 additions and 8 deletions

View File

@@ -0,0 +1,29 @@
<?php
namespace App\Scheduler;
use App\Message\SendNotifWatchListTrigger;
use Symfony\Component\Scheduler\Attribute\AsSchedule;
use Symfony\Component\Scheduler\RecurringMessage;
use Symfony\Component\Scheduler\Schedule;
use Symfony\Component\Scheduler\ScheduleProviderInterface;
use Symfony\Contracts\Cache\CacheInterface;
#[AsSchedule('notif_watchlist')]
final readonly class SendNotifWatchListTriggerSchedule implements ScheduleProviderInterface
{
public function __construct(
private CacheInterface $cache,
) {
}
public function getSchedule(): Schedule
{
return (new Schedule())
->add(
RecurringMessage::every('1 week', new SendNotifWatchListTrigger()),
)
->stateful($this->cache)
;
}
}