I'm trying to disable the profiler when generating the functional tests. According to https://symfony.com/doc/current/profiler.html, the profiler service should be available via autowiring, but I keep getting an error.
#[AsCommand('generate:smoke', 'Generate the smoke test')]
final class MakeSmokeTestCommand extends Command
{
public function __construct(
private readonly RouterInterface $router,
#[Autowire('%kernel.project_dir%/tests/')] private string $testDir,
?Profiler $profiler=null,
)
{
parent::__construct();
$profiler?->disable();
}
In DefinitionErrorExceptionPass.php line 48:
[Symfony\Component\DependencyInjection\Exception\RuntimeException]
Cannot autowire service "Survos\CrawlerBundle\Command\CrawlCommand": argument "$profiler" of method "__construct()" references class "Symfony\Component\HttpKernel\Profiler\Profiler" but no such service exists. You should maybe alias this class to the existing "profiler" service.
Any ideas?
I know we can filter the routes other ways, but it seems like disabling the profiler altogether would be better.
I'm trying to disable the profiler when generating the functional tests. According to https://symfony.com/doc/current/profiler.html, the profiler service should be available via autowiring, but I keep getting an error.
In DefinitionErrorExceptionPass.php line 48:
[Symfony\Component\DependencyInjection\Exception\RuntimeException]
Cannot autowire service "Survos\CrawlerBundle\Command\CrawlCommand": argument "$profiler" of method "__construct()" references class "Symfony\Component\HttpKernel\Profiler\Profiler" but no such service exists. You should maybe alias this class to the existing "profiler" service.
Any ideas?
I know we can filter the routes other ways, but it seems like disabling the profiler altogether would be better.