Doctrine 1.2.4
Doctrine_Event Class Reference

Public Member Functions

 __construct ($invoker, $code, $query=null, $params=array())
 
 __get ($option)
 
 __set ($option, $value)
 
 end ()
 
 getCode ()
 
 getElapsedSecs ()
 
 getInvoker ()
 
 getName ()
 
 getParams ()
 
 getQuery ()
 
 getSequence ()
 
 hasEnded ()
 
 set ($option, &$value)
 
 setInvoker ($invoker)
 
 skipOperation ()
 
 start ()
 

Data Fields

const CONN_QUERY = 1
 

Detailed Description

Definition at line 33 of file Event.php.

Constructor & Destructor Documentation

Doctrine_Event::__construct (   $invoker,
  $code,
  $query = null,
  $params = array() 
)

constructor

Parameters
Doctrine_Connection|Doctrine_Connection_Statement|Doctrine_Connection_UnitOfWork|Doctrine_Transaction $invoker the handler which invoked this event
integer$codethe event code
string$querythe sql query associated with this event (if any)

Definition at line 126 of file Event.php.

{
$this->_sequence = self::$_nextSequence++;
$this->_invoker = $invoker;
$this->_code = $code;
$this->_query = $query;
$this->_params = $params;
}

Member Function Documentation

Doctrine_Event::__get (   $option)

getOption returns the value of an option

Parameters
string$optionthe name of the option
Returns
mixed

Definition at line 228 of file Event.php.

{
if ( ! isset($this->_options[$option])) {
return null;
}
return $this->_options[$option];
}
Doctrine_Event::__set (   $option,
  $value 
)

setOption sets the value of an option

Parameters
string$optionthe name of the option
mixed$valuethe value of the given option
Returns
Doctrine_Event this object

Definition at line 259 of file Event.php.

{
$this->_options[$option] = $value;
return $this;
}
Doctrine_Event::end ( )

end ends the internal timer of this event

Returns
Doctrine_Event this object

Definition at line 309 of file Event.php.

{
$this->_endedMicrotime = microtime(true);
return $this;
}
Doctrine_Event::getCode ( )

getCode

Returns
integer returns the code associated with this event

Definition at line 216 of file Event.php.

{
return $this->_code;
}
Doctrine_Event::getElapsedSecs ( )

Get the elapsed time (in microseconds) that the event ran. If the event has not yet ended, return false.

Returns
integer

Definition at line 368 of file Event.php.

{
if (is_null($this->_endedMicrotime)) {
return false;
}
return ($this->_endedMicrotime - $this->_startedMicrotime);
}
Doctrine_Event::getInvoker ( )

getInvoker returns the handler that invoked this event

Returns
Doctrine_Connection|Doctrine_Connection_Statement| Doctrine_Connection_UnitOfWork|Doctrine_Transaction the handler that invoked this event

Definition at line 334 of file Event.php.

{
return $this->_invoker;
}
Doctrine_Event::getName ( )

getName returns the name of this event

Returns
string the name of this event

Definition at line 151 of file Event.php.

{
switch ($this->_code) {
case self::CONN_QUERY:
return 'query';
case self::CONN_EXEC:
return 'exec';
case self::CONN_PREPARE:
return 'prepare';
case self::CONN_CONNECT:
return 'connect';
case self::CONN_CLOSE:
return 'close';
case self::CONN_ERROR:
return 'error';
case self::STMT_EXECUTE:
return 'execute';
case self::STMT_FETCH:
return 'fetch';
case self::STMT_FETCHALL:
return 'fetch all';
case self::TX_BEGIN:
return 'begin';
case self::TX_COMMIT:
return 'commit';
case self::TX_ROLLBACK:
return 'rollback';
case self::SAVEPOINT_CREATE:
return 'create savepoint';
case self::SAVEPOINT_ROLLBACK:
return 'rollback savepoint';
case self::SAVEPOINT_COMMIT:
return 'commit savepoint';
case self::RECORD_DELETE:
return 'delete record';
case self::RECORD_SAVE:
return 'save record';
case self::RECORD_UPDATE:
return 'update record';
case self::RECORD_INSERT:
return 'insert record';
case self::RECORD_SERIALIZE:
return 'serialize record';
case self::RECORD_UNSERIALIZE:
return 'unserialize record';
case self::RECORD_DQL_SELECT:
return 'select records';
case self::RECORD_DQL_DELETE:
return 'delete records';
case self::RECORD_DQL_UPDATE:
return 'update records';
case self::RECORD_VALIDATE:
return 'validate record';
}
}
Doctrine_Event::getParams ( )

getParams returns the parameters of the query

Returns
array parameters of the query

Definition at line 357 of file Event.php.

{
return $this->_params;
}
Doctrine_Event::getQuery ( )

getQuery

Returns
Doctrine_Query returns the query associated with this event (if any)

Definition at line 140 of file Event.php.

{
return $this->_query;
}
Doctrine_Event::getSequence ( )

getSequence returns the sequence of this event

Returns
integer

Definition at line 322 of file Event.php.

{
return $this->_sequence;
}
Doctrine_Event::hasEnded ( )

hasEnded whether or not this event has ended

Returns
boolean

Definition at line 298 of file Event.php.

{
return ($this->_endedMicrotime != null);
}
Doctrine_Event::set (   $option,
$value 
)

setOption sets the value of an option by reference

Parameters
string$optionthe name of the option
mixed$valuethe value of the given option
Returns
Doctrine_Event this object

Definition at line 274 of file Event.php.

{
$this->_options[$option] =& $value;
return $this;
}
Doctrine_Event::setInvoker (   $invoker)

setInvoker Defines new invoker (used in Hydrator)

Parameters
mixed$invoker
Returns
void

Definition at line 346 of file Event.php.

{
$this->_invoker = $invoker;
}
Doctrine_Event::skipOperation ( )

skipOperation skips the next operation an alias for __set('skipOperation', true)

Returns
Doctrine_Event this object

Definition at line 244 of file Event.php.

{
$this->_options['skipOperation'] = true;
return $this;
}
Doctrine_Event::start ( )

start starts the internal timer of this event

Returns
Doctrine_Event this object

Definition at line 287 of file Event.php.

{
$this->_startedMicrotime = microtime(true);
}

Field Documentation

const Doctrine_Event::CONN_QUERY = 1

CONNECTION EVENT CODES

Definition at line 38 of file Event.php.


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