File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed
Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change 1+ {
2+ "copy-from-recipe" : {
3+ "src/" : " %SRC_DIR%/"
4+ },
5+ "aliases" : [" schedule" , " scheduling" ]
6+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace App ;
4+
5+ use Symfony \Component \Scheduler \Attribute \AsSchedule ;
6+ use Symfony \Component \Scheduler \Schedule as SymfonySchedule ;
7+ use Symfony \Component \Scheduler \ScheduleProviderInterface ;
8+ use Symfony \Contracts \Cache \CacheInterface ;
9+
10+ #[AsSchedule]
11+ class Schedule implements ScheduleProviderInterface
12+ {
13+ public function __construct (
14+ private CacheInterface $ cache ,
15+ ) {
16+ }
17+
18+ public function getSchedule (): SymfonySchedule
19+ {
20+ return (new SymfonySchedule ())
21+ ->stateful ($ this ->cache ) // ensure missed tasks are executed
22+ ->processOnlyLastMissedRun (true ) // ensure only last missed task is run
23+
24+ // add your own tasks here
25+ // see https://symfony.com/doc/current/scheduler.html#attaching-recurring-messages-to-a-schedule
26+ ;
27+ }
28+ }
You can’t perform that action at this time.
0 commit comments