/** * @param Pomm $pomm * * @return null */ public function configure(Pomm $pomm) { $callable = [$this->datacollector, 'execute']; foreach ($pomm->getSessionBuilders() as $name => $builder) { $pomm->addPostConfiguration($name, function ($session) use($callable) { $session->getClientUsingPooler('listener', 'query')->attachAction($callable); }); } }
/** * __construct * * Attach profiler actions to each query builder. * * @access public * @param Pomm $pomm * @return null */ public function __construct(Pomm $pomm) { $this->queries = []; foreach ($pomm->getSessionBuilders() as $name => $builder) { $listener = new Listener('query'); $listener->attachAction(array($this, 'execute')); $pomm->getSession($name)->registerClient($listener); } }
public function __construct(Pomm $pomm, Stopwatch $stopwatch = null) { $this->stopwatch = $stopwatch; $this->data = ['time' => 0, 'queries' => [], 'exception' => null]; $callable = [$this, 'execute']; foreach ($pomm->getSessionBuilders() as $name => $builder) { $pomm->addPostConfiguration($name, function ($session) use($callable) { $session->getClientUsingPooler('listener', 'query')->attachAction($callable); }); } }