PHP 8.1 Symfony 5.4 Doctrine 2.10
I'm profiling a PHP command (with blackfire) with dummy code for testing :
class MyCommand extends Command
{
...
protected function execute(InputInterface $input, OutputInterface $output): int
{
$query = $this->entityManager->createQuery(
"SELECT t from App\Entity\MyEntity t"
);
$query->setMaxResults(20);
$i = 0;
foreach ($query->getResult() as $transaction) {
$i++;
}
$output->writeln($i);
$this->entityManager->flush();
return self::SUCCESS;
}
...
}
So as you can see, no change made, no setter called.
But when I profile my command, I can see that doctrine made as many updates as there are entities :
It seems really unecessary, do you know what configuration could be causing this ?