@@ -48,7 +48,7 @@ the task of creating a report::
48
48
49
49
class SendDailySalesReports
50
50
{
51
- public function __construct(private string $id) {}
51
+ public function __construct(private int $id) {}
52
52
53
53
public function getId(): int
54
54
{
@@ -61,6 +61,9 @@ Next, create the handler that processes that kind of message::
61
61
// src/Scheduler/Handler/SendDailySalesReportsHandler.php
62
62
namespace App\Scheduler\Handler;
63
63
64
+ use App\Scheduler\Message\SendDailySalesReports;
65
+ use Symfony\Component\Messenger\Attribute\AsMessageHandler;
66
+
64
67
#[AsMessageHandler]
65
68
class SendDailySalesReportsHandler
66
69
{
@@ -105,9 +108,13 @@ The :class:`Symfony\\Component\\Scheduler\\Attribute\\AsSchedule` attribute,
105
108
which by default references the schedule named ``default ``, allows you to register
106
109
on a particular schedule::
107
110
108
- // src/Scheduler/MyScheduleProvider .php
111
+ // src/Scheduler/SaleTaskProvider .php
109
112
namespace App\Scheduler;
110
113
114
+ use Symfony\Component\Scheduler\Attribute\AsSchedule;
115
+ use Symfony\Component\Scheduler\Schedule;
116
+ use Symfony\Component\Scheduler\ScheduleProviderInterface;
117
+
111
118
#[AsSchedule]
112
119
class SaleTaskProvider implements ScheduleProviderInterface
113
120
{
@@ -260,7 +267,7 @@ Then, define your recurring message::
260
267
261
268
Finally, the recurring messages has to be attached to a schedule::
262
269
263
- // src/Scheduler/MyScheduleProvider .php
270
+ // src/Scheduler/SaleTaskProvider .php
264
271
namespace App\Scheduler;
265
272
266
273
#[AsSchedule('uptoyou')]
@@ -344,7 +351,7 @@ via the ``stateful`` option (and the :doc:`Cache component </components/cache>`)
344
351
This way, when it wakes up again, it looks at all the dates and can catch up on
345
352
what it missed::
346
353
347
- // src/Scheduler/MyScheduleProvider .php
354
+ // src/Scheduler/SaleTaskProvider .php
348
355
namespace App\Scheduler;
349
356
350
357
#[AsSchedule('uptoyou')]
@@ -366,7 +373,7 @@ To scale your schedules more effectively, you can use multiple workers. In such
366
373
cases, a good practice is to add a :doc: `lock </components/lock >` to prevent the
367
374
same task more than once::
368
375
369
- // src/Scheduler/MyScheduleProvider .php
376
+ // src/Scheduler/SaleTaskProvider .php
370
377
namespace App\Scheduler;
371
378
372
379
#[AsSchedule('uptoyou')]
@@ -395,7 +402,7 @@ your message in a :class:`Symfony\\Component\\Messenger\\Message\\RedispatchMess
395
402
This allows you to specify a transport on which your message will be redispatched
396
403
before being further redispatched to its corresponding handler::
397
404
398
- // src/Scheduler/MyScheduleProvider .php
405
+ // src/Scheduler/SaleTaskProvider .php
399
406
namespace App\Scheduler;
400
407
401
408
#[AsSchedule('uptoyou')]
0 commit comments