Skip to content

Commit 7ede023

Browse files
Update project with latest recipes
1 parent 69251b0 commit 7ede023

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

src/Schedule.php

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the CleverAge/ProcessBundleDemo package.
5+
*
6+
* Copyright (c) Clever-Age
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace App;
13+
14+
use Symfony\Component\Scheduler\Attribute\AsSchedule;
15+
use Symfony\Component\Scheduler\Schedule as SymfonySchedule;
16+
use Symfony\Component\Scheduler\ScheduleProviderInterface;
17+
use Symfony\Contracts\Cache\CacheInterface;
18+
19+
#[AsSchedule]
20+
class Schedule implements ScheduleProviderInterface
21+
{
22+
public function __construct(
23+
private readonly CacheInterface $cache,
24+
) {
25+
}
26+
27+
public function getSchedule(): SymfonySchedule
28+
{
29+
return (new SymfonySchedule())
30+
->stateful($this->cache) // ensure missed tasks are executed
31+
->processOnlyLastMissedRun(true) // ensure only last missed task is run
32+
33+
// add your own tasks here
34+
// see https://symfony.com/doc/current/scheduler.html#attaching-recurring-messages-to-a-schedule
35+
;
36+
}
37+
}

symfony.lock

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@
2020
"cleverage/ui-process-bundle": {
2121
"version": "dev-prepare-release"
2222
},
23+
"doctrine/deprecations": {
24+
"version": "1.1",
25+
"recipe": {
26+
"repo": "github.com/symfony/recipes",
27+
"branch": "main",
28+
"version": "1.0",
29+
"ref": "87424683adc81d7dc305eefec1fced883084aab9"
30+
}
31+
},
2332
"doctrine/doctrine-bundle": {
2433
"version": "2.13",
2534
"recipe": {
@@ -245,6 +254,18 @@
245254
"config/routes.yaml"
246255
]
247256
},
257+
"symfony/scheduler": {
258+
"version": "7.2",
259+
"recipe": {
260+
"repo": "github.com/symfony/recipes",
261+
"branch": "main",
262+
"version": "7.2",
263+
"ref": "caea3c928ee9e1b21288fd76aef36f16ea355515"
264+
},
265+
"files": [
266+
"src/Schedule.php"
267+
]
268+
},
248269
"symfony/security-bundle": {
249270
"version": "7.2",
250271
"recipe": {

0 commit comments

Comments
 (0)