Commit 7095ee9
committed
bug symfony#60741 [Scheduler] Fix
This PR was merged into the 7.3 branch.
Discussion
----------
[Scheduler] Fix `#[AsCronTask]` not passing arguments to command
| Q | A
| ------------- | ---
| Branch? | 7.3
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Issues | -
| License | MIT
This MR fixes passing `AsCronTask` arguments to `Command`. Reproduced can be by following command. It wont receive `--all` option or any other argument specified in `AsCronTask` when executed by Scheduler.
```
#[AsCommand(name: 'debug:as-cron-task')]
#[AsCronTask('* * * * *', arguments: '--all')]
class SampleCommand extends Command
{
protected function configure(): void
{
$this->addOption('all', null, InputOption::VALUE_NONE);
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
dump($input->getOption('all'));
return Command::SUCCESS;
}
}
```
Fix description: When command name was found in `AsCommand` attribute then attributes were not appended to message definition due to missing brackets.
Commits
-------
b57a815 Fix AsCronTask not passing arguments to command#[AsCronTask] not passing arguments to command (Jan Pintr, jan-pintr)File tree
4 files changed
+60
-1
lines changed- src/Symfony
- Bundle/FrameworkBundle/Tests
- Fixtures/Messenger
- Functional
- app/Scheduler
- Component/Scheduler/DependencyInjection
4 files changed
+60
-1
lines changedLines changed: 30 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
Lines changed: 24 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
88 | 89 | | |
89 | 90 | | |
90 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
91 | 115 | | |
92 | 116 | | |
93 | 117 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
19 | 22 | | |
20 | 23 | | |
21 | 24 | | |
| |||
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
62 | 64 | | |
63 | 65 | | |
64 | 66 | | |
| |||
0 commit comments