[Scheduler] Fix #[AsCronTask] not passing arguments to command#60741
Conversation
|
Test added. But branch was reverted to 7.3, because the problem was introduced in 7.3 (here #59711) Is it ok? |
Oh, my bad - so the problem doesn't exist < 7.3? |
|
Yes, it did not exist in <7.3 |
kbond
left a comment
There was a problem hiding this comment.
Code looks good! I'm not 100% sure of the issue with the one CI failure.
|
Not sure either. Before test fails there is log I suppose that the reason is that the |
Yeah, that's what I'm thinking It should be fixed once merged though. |
#[AsCronTask] not passing arguments to command
|
Suggestion applied, thank you. |
cf6c25d to
b57a815
Compare
|
Thank you @jan-pintr. |
|
Hello, thanks, Idk if this is a real problem or something supported, but as there is no nullsafe check on $tagAttributes['arguments'] here, this is breaking a tag on my use case, which is a "scheduler.task" tag added in a LoadExtension bundle I'm currently developping. I'm notifying because every others attributes seems optionnals : $myService->tag('scheduler.task', [
'frequency' => 15,
'schedule' => $config['schedule'],
'trigger' => 'every',
'arguments' => null, // <- had to add this line to avoid a Warning: Undefined array key "arguments"
]); |
|
@johndodev Please look at #61307. Even at least |
… (Jan Pintr) This PR was squashed before being merged into the 7.3 branch. Discussion ---------- [Scheduler] Fix `scheduler.task` tag arguments optionality | Q | A | ------------- | --- | Branch? | 7.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | - | License | MIT According to [this comment](#60741 (comment)) there is a change in behaviour after #60741 which causes requiring specify `arguments` parameter when tagging `scheduler.task` manually. This pull request makes `arguments` parameter back optional. ``` $myService->tag('scheduler.task', [ 'trigger' => 'every', 'frequency' => 15, 'arguments' => null, // <- had to add this line to avoid a Warning: Undefined array key "arguments" ]); ``` Commits ------- ad08041 [Scheduler] Fix `scheduler.task` tag arguments optionality
This MR fixes passing
AsCronTaskarguments toCommand. Reproduced can be by following command. It wont receive--alloption or any other argument specified inAsCronTaskwhen executed by Scheduler.Fix description: When command name was found in
AsCommandattribute then attributes were not appended to message definition due to missing brackets.