Skip to content

Commit 53213f3

Browse files
committed
[1.4] fixed Doctrine queries execution time in the profiler (closes #10079, patch from jakub.turek)
http://trac.symfony-project.org/changeset/33570
1 parent 52b61ec commit 53213f3

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

lib/debug/sfTimerManager.class.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,17 @@ class sfTimerManager
2929
*
3030
* @return sfTimer The timer instance
3131
*/
32-
public static function getTimer($name)
32+
public static function getTimer($name, $reset=true)
3333
{
3434
if (!isset(self::$timers[$name]))
3535
{
3636
self::$timers[$name] = new sfTimer($name);
3737
}
3838

39-
self::$timers[$name]->startTimer();
39+
if ($reset)
40+
{
41+
self::$timers[$name]->startTimer();
42+
}
4043

4144
return self::$timers[$name];
4245
}

lib/plugins/sfDoctrinePlugin/lib/database/sfDoctrineConnectionProfiler.class.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function preQuery(Doctrine_Event $event)
8282
*/
8383
public function postQuery(Doctrine_Event $event)
8484
{
85-
sfTimerManager::getTimer('Database (Doctrine)')->addTime();
85+
sfTimerManager::getTimer('Database (Doctrine)', false)->addTime();
8686

8787
$args = func_get_args();
8888
$this->__call(__FUNCTION__, $args);
@@ -118,7 +118,7 @@ public function preExec(Doctrine_Event $event)
118118
*/
119119
public function postExec(Doctrine_Event $event)
120120
{
121-
sfTimerManager::getTimer('Database (Doctrine)')->addTime();
121+
sfTimerManager::getTimer('Database (Doctrine)', false)->addTime();
122122

123123
$args = func_get_args();
124124
$this->__call(__FUNCTION__, $args);
@@ -154,7 +154,7 @@ public function preStmtExecute(Doctrine_Event $event)
154154
*/
155155
public function postStmtExecute(Doctrine_Event $event)
156156
{
157-
sfTimerManager::getTimer('Database (Doctrine)')->addTime();
157+
sfTimerManager::getTimer('Database (Doctrine)', false)->addTime();
158158

159159
$args = func_get_args();
160160
$this->__call(__FUNCTION__, $args);

0 commit comments

Comments
 (0)