DoctrineFixturesBundle icon indicating copy to clipboard operation
DoctrineFixturesBundle copied to clipboard

Impossible to profile LoadDataFixturesDoctrineCommand

Open garak opened this issue 1 year ago • 2 comments

Symfony 6.4.7 DoctrineBundle 2.12.0 FixturesBundle 3.6.0 ORM 3.1.3

When I try to run bin/console do:fi:lo --profile -v I get the following:

[Error]
Call to protected method Doctrine\Bundle\FixturesBundle\Command\LoadDataFixturesDoctrineCommand::execute() from scope Symfony\Component\Console\Command\TraceableCommand

trace:

at /myproject/vendor/symfony/console/Command/TraceableCommand.php:331
Symfony\Component\Console\Command\TraceableCommand->execute() at /myproject/vendor/symfony/console/Command/Command.php:326
Symfony\Component\Console\Command\Command->run() at /myproject/vendor/symfony/console/Command/TraceableCommand.php:286
Symfony\Component\Console\Command\TraceableCommand->run() at /myproject/vendor/symfony/console/Application.php:1096
Symfony\Component\Console\Application->doRunCommand() at /myproject/vendor/symfony/framework-bundle/Console/Application.php:126
Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() at /myproject/vendor/symfony/console/Application.php:324
Symfony\Component\Console\Application->doRun() at /myproject/vendor/symfony/framework-bundle/Console/Application.php:80
Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /myproject/vendor/symfony/console/Application.php:175

The command is working properly without the --profile flag.

garak avatar May 08 '24 10:05 garak

It seems that the problem is linked to using the CommandCompatibility trait. If I remove it, the profiling doesn't throw an exception anymore. I see that trait was introduced in PR #402 by @derrabus but I can't understand its purpose... the covariance allows us to add the return type, without the need for a check.

garak avatar Jun 21 '24 11:06 garak

I can't understand its purpose... the covariance allows us to add the return type, without the need for a check.

Adding a return type to a non-final class is a breaking change. On 4.0.x, the trait is gone already.

derrabus avatar Jun 21 '24 11:06 derrabus