Doctrine 1.2.4
Doctrine_Connection_Profiler Class Reference

Inherits Doctrine_Overloadable, IteratorAggregate, and Countable.

Public Member Functions

 __construct ()
 
 __call ($m, $a)
 
 count ()
 
 get ($key)
 
 getAll ()
 
 getIterator ()
 
 lastEvent ()
 
 pop ()
 
 setFilterQueryType ()
 

Detailed Description

Definition at line 33 of file Profiler.php.

Constructor & Destructor Documentation

Doctrine_Connection_Profiler::__construct ( )

constructor

Definition at line 60 of file Profiler.php.

{
}

Member Function Documentation

Doctrine_Connection_Profiler::__call (   $m,
  $a 
)

method overloader this method is used for invoking different listeners, for the full list of availible listeners, see Doctrine_EventListener

Parameters
string$mthe name of the method
array$amethod arguments
See Also
Doctrine_EventListener
Returns
boolean

Definition at line 83 of file Profiler.php.

{
// first argument should be an instance of Doctrine_Event
if ( ! ($a[0] instanceof Doctrine_Event)) {
throw new Doctrine_Connection_Profiler_Exception("Couldn't listen event. Event should be an instance of Doctrine_Event.");
}
if (substr($m, 0, 3) === 'pre') {
// pre-event listener found
$a[0]->start();
$eventSequence = $a[0]->getSequence();
if ( ! isset($this->eventSequences[$eventSequence])) {
$this->events[] = $a[0];
$this->eventSequences[$eventSequence] = true;
}
} else {
// after-event listener found
$a[0]->end();
}
}
Doctrine_Connection_Profiler::count ( )

count

Returns
integer

Definition at line 147 of file Profiler.php.

{
return count($this->events);
}
Doctrine_Connection_Profiler::get (   $key)

get

Parameters
mixed$key
Returns
Doctrine_Event

Definition at line 112 of file Profiler.php.

{
if (isset($this->events[$key])) {
return $this->events[$key];
}
return null;
}
Doctrine_Connection_Profiler::getAll ( )

getAll returns all profiled events as an array

Returns
array all events in an array

Definition at line 126 of file Profiler.php.

{
return $this->events;
}
Doctrine_Connection_Profiler::getIterator ( )

getIterator returns an iterator that iterates through the logged events

Returns
ArrayIterator

Definition at line 137 of file Profiler.php.

{
return new ArrayIterator($this->events);
}
Doctrine_Connection_Profiler::lastEvent ( )

Get the Doctrine_Event object for the last query that was run, regardless if it has ended or not. If the event has not ended, it's end time will be Null.

Returns
Doctrine_Event

Definition at line 173 of file Profiler.php.

{
if (empty($this->events)) {
return false;
}
end($this->events);
return current($this->events);
}
Doctrine_Connection_Profiler::pop ( )

pop the last event from the event stack

Returns
Doctrine_Event

Definition at line 157 of file Profiler.php.

{
$event = array_pop($this->events);
if ($event !== null)
{
unset($this->eventSequences[$event->getSequence()]);
}
return $event;
}
Doctrine_Connection_Profiler::setFilterQueryType ( )

setFilterQueryType

Parameters
integer$filter
Returns
boolean

Definition at line 70 of file Profiler.php.

{
}

The documentation for this class was generated from the following file: