Skip to content

Instantly share code, notes, and snippets.

@ranacseruet
Created March 22, 2014 03:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ranacseruet/9700579 to your computer and use it in GitHub Desktop.
Save ranacseruet/9700579 to your computer and use it in GitHub Desktop.
Custom CodeIgnite Profiler Class For Doctrine
<?php
namespace Doctrine\DBAL\Logging;
class CIProfiler implements SQLLogger
{
public $start = null;
private $ci;
public function __construct()
{
$this->ci =& get_instance();
}
/**
* {@inheritdoc}
*/
public function startQuery($sql, array $params = null, array $types = null)
{
$this->start = microtime(true);
$this->ci->db->queries[] = "/* doctrine */ \n".$sql;
}
/**
* {@inheritdoc}
*/
public function stopQuery()
{
$this->ci->db->query_times[] = microtime(true) - $this->start;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment