Skip to content

[Scheduler] Fix AsCronTask not passing arguments to command #60741

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: 7.3
Choose a base branch
from

Conversation

jan-pintr
Copy link

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.

Copy link
Member

@kbond kbond left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for finding/fixing this! Can you target 6.4?

Do you think you'd be up for adding some tests here to prevent a regression?

@jan-pintr jan-pintr changed the base branch from 7.3 to 6.4 June 9, 2025 15:54
@jan-pintr jan-pintr changed the base branch from 6.4 to 7.4 June 9, 2025 15:54
@jan-pintr jan-pintr changed the base branch from 7.4 to 7.3 June 9, 2025 17:24
@jan-pintr
Copy link
Author

Test added. But branch was reverted to 7.3, because the problem was introduced in 7.3 (here #59711) Is it ok?

@kbond
Copy link
Member

kbond commented Jun 9, 2025

because the problem was introduced in 7.3

Oh, my bad - so the problem doesn't exist < 7.3?

@jan-pintr
Copy link
Author

Yes, it did not exist in <7.3

@lyrixx lyrixx removed their request for review June 10, 2025 08:28
Copy link
Member

@kbond kbond left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good! I'm not 100% sure of the issue with the one CI failure.

@jan-pintr
Copy link
Author

Not sure either. Before test fails there is log Installing symfony/scheduler (7.4.x-dev ac9f564): Extracting archive.

I suppose that the reason is that the high-deps is runned against 7.4.x-dev in which it is not fixed yet? Could that be the reason?

@kbond
Copy link
Member

kbond commented Jun 10, 2025

Could that be the reason?

Yeah, that's what I'm thinking but I would have expected this issue with "low-deps" (oh, I forgot this wasn't an issue in 6.4 so that makes sense).

It should be fixed once merged though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy