Commit 628aac0e authored by zYne's avatar zYne

--no commit message

--no commit message
parent 9f8fbba4
......@@ -145,7 +145,7 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module
$record->preSave($event);
if ( ! $event->getSkipOperation()) {
if ( ! $event->getOption('skipOperation')) {
switch ($record->state()) {
case Doctrine_Record::STATE_TDIRTY:
$this->insert($record);
......@@ -188,7 +188,7 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module
$this->deleteComposites($record);
if ( ! $event->getSkipOperation()) {
if ( ! $event->getOption('skipOperation')) {
$this->conn->transaction->addDelete($record);
$record->state(Doctrine_Record::STATE_TCLEAN);
......@@ -340,7 +340,7 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module
$record->preUpdate($event);
if ( ! $event->getSkipOperation()) {
if ( ! $event->getOption('skipOperation')) {
$array = $record->getPrepared();
if (empty($array)) {
......@@ -399,7 +399,7 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module
$record->preInsert($event);
if ( ! $event->getSkipOperation()) {
if ( ! $event->getOption('skipOperation')) {
$array = $record->getPrepared();
if (empty($array)) {
......
......@@ -75,9 +75,9 @@ class Doctrine_Event
*/
protected $_endedMicrotime;
/**
* @var boolean $skipOperation
* @var array $_options an array of options
*/
protected $_skipOperation = false;
protected $_options = array();
/**
* constructor
*
......@@ -138,28 +138,50 @@ class Doctrine_Event
return $this->_code;
}
/**
* setSkipOperation
* getOption
* returns the value of an option
*
* @return void
* @param string $option the name of the option
* @return mixed
*/
public function getOption($option)
{
if ( ! isset($this->_options[$option])) {
return null;
}
return $this->_options[$option];
}
/**
* skipOperation
* skips the next operation
* an alias for setOption('skipOperation', true)
*
* @return Doctrine_Event this object
*/
public function setSkipOperation($bool)
public function skipOperation()
{
$this->_skipOperation = (bool) $bool;
return $this->setOption('skipOperation', true);
}
/**
* getSkipOperation
* setOption
* sets the value of an option
*
* @return void
* @param string $option the name of the option
* @param mixed $value the value of the given option
* @return Doctrine_Event this object
*/
public function getSkipOperation()
public function setOption($option, $value)
{
return $this->_skipOperation;
$this->_options[$option] = $value;
return $this;
}
/**
* start
* starts the internal timer of this event
*
* @return void
* @return Doctrine_Event this object
*/
public function start()
{
......@@ -179,11 +201,13 @@ class Doctrine_Event
* end
* ends the internal timer of this event
*
* @return void
* @return Doctrine_Event this object
*/
public function end()
{
$this->_endedMicrotime = microtime(true);
return $this;
}
/**
* getInvoker
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment