private function dbProfilerRegister()
    {
        $profiler = self::registerProfiler('db', '<i class="nuc db"></i>');

        $this->em->attach(
          Events::DB,
          function (Event $event, Adapter\Pdo $connection) use ($profiler) {
              $eventType = $event->getType();
              if ($eventType === 'beforeQuery') {
                  // Start a profile with the active connection
                  $profiler->startProfile(
                    $connection->getSQLStatement(),
                    $connection->getSqlVariables(),
                    $connection->getSQLBindTypes()
                  );
              }
              if ($eventType === 'afterQuery') {
                  // Stop the active profile
                  $profiler->stopProfile();
              }
          }
        );
    }
private function dbProfilerRegister()
    {
        $profiler = self::registerProfiler('db', '<i class="nuc db"></i>');

        $this->em->attach(
          Events::DB,
          function (Event $event, Adapter\Pdo $connection) use ($profiler) {
              $eventType = $event->getType();
              if ($eventType === 'beforeQuery') {
                  // Start a profile with the active connection
                  $profiler->startProfile(
                    $connection->getSQLStatement(),
                    $connection->getSqlVariables(),
                    $connection->getSQLBindTypes()
                  );
              }
              if ($eventType === 'afterQuery') {
                  // Stop the active profile
                  $profiler->stopProfile();
              }
          }
        );
    }
private function dbProfilerRegister ( ) { $ profiler = self :: registerProfiler ( 'db' , '<i class="nuc db"></i>' ) ; $ this -> em -> attach ( Events :: DB , function ( Event $ event , Adapter \ Pdo $ connection ) use ( $ profiler ) { $ eventType = $ event -> getType ( ) ; if ( $ eventType === 'beforeQuery' ) { // Start a profile with the active connection $ profiler -> startProfile ( $ connection -> getSQLStatement ( ) , $ connection -> getSqlVariables ( ) , $ connection -> getSQLBindTypes ( ) ) ; } if ( $ eventType === 'afterQuery' ) { // Stop the active profile $ profiler -> stopProfile ( ) ; } } ) ; }
Register db profiler
Register db profiler