You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my command I had a description like class MyCommand extends Command { protected static $defaultDescription = '...';
and that was the problem!
With the description, the $this->application->all() return Symfony\Component\Console\Command\LazyCommand , instead of MyCommand class.
Than the LazyCommand class is used as argument for the reflection in the next line $reflClass = new ReflectionClass($command);
Removing the description from MyCommand worked fine.
I hope that this little explanation could help someone when updating symfony
Activity
frostieDE commentedon Aug 7, 2021
As a workaround, you may specify the command schedule inside your configuration using a dedicated tag as such:
(see https://github.com/shapecode/cron-bundle/blob/master/src/DependencyInjection/Compiler/CronJobCompilerPass.php)
Unfortunately I am currently unable to verify whether this command is still considered lazy.
alessandro-podo commentedon Jan 23, 2022
i want to use this Bundle with SF6
an possible Solution for that is, to use the new TaggedIterator(SF5.3) to get all Commands.
What do you say?
nicklog commentedon Jan 24, 2022
I'll take a look at it ;)
alessandro-podo commentedon Jan 24, 2022
as a POC:
`class GetTaggedService
{
public function __construct(#[TaggedIterator('console.command')] private iterable $commands, private Reader $reader)
{
}
}
`
c33s commentedon Jun 27, 2022
my workaround:
Shapecode\Bundle\CronBundle\EventListener\AnnotationJobLoaderListener: