Closed
Description
Symfony version(s) affected
7.0
Description
Since I updated a project from 6.3 to 7.0, the global query time for Doctrine queries is always at 0.00 ms on the profiler.
How to reproduce
Do multiple doctrine calls on a same http request
Possible Solution
After a few tests, it seems that the problem comes from the switch to native return types on Symfony\Bridge\Doctrine\DataCollector\DoctrineDataCollector
method.
For context :
public function getTime(): int
{
$time = 0;
foreach ($this->data['queries'] as $queries) {
foreach ($queries as $query) {
$time += $query['executionMS'];
}
}
return $time;
}
Inside the getTime
method, when I check what's inside $time
before the return, I have a float smaller than 0 (something like 0.0015671253204346 for example)
So when returning, this value is casted to int and become 0.
After changing the return type of the getTime
method to float, the calculation worked again.
Working on a PR.
Additional Context
No response