Skip to content
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

Add connection profiler if "--profile" is used for CLI commands #3702

Closed
AndreasA opened this issue May 8, 2024 · 2 comments
Closed

Add connection profiler if "--profile" is used for CLI commands #3702

AndreasA opened this issue May 8, 2024 · 2 comments
Labels

Comments

@AndreasA
Copy link
Contributor

AndreasA commented May 8, 2024

PHP Version

8.1

Shopware Version

6.5 & 6.6

Expected behaviour

If the new Symfoyn 6.4+ option "--profile" is used, then I expect the database middleware to be used even in CLI mode.

see https://symfony.com/blog/new-in-symfony-6-4-command-profiler

Actual behaviour

Databae middleware is not used and therefore queries are not collected

How to reproduce

Call any command with --profile and open the command profiler for it. it does not log any queries.

@AndreasA AndreasA added the Bug label May 8, 2024
@AndreasA
Copy link
Contributor Author

AndreasA commented May 8, 2024

the easiest solution would be to just replace the check to something like this.

if ((\PHP_SAPI !== 'cli' || (new \Symfony\Component\Console\Input\ArgvInput())->hasParameterOption('--profile')) && $this->environment !== 'prod' && InstalledVersions::isInstalled('symfony/doctrine-bridge')) {

or

if ((\PHP_SAPI !== 'cli' || in_array('--profile', $_SERVER['argv'] ?? [], true)) && $this->environment !== 'prod' && InstalledVersions::isInstalled('symfony/doctrine-bridge')) {

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

No branches or pull requests

2 participants