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 ...@@ -145,7 +145,7 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module
$record->preSave($event); $record->preSave($event);
if ( ! $event->getSkipOperation()) { if ( ! $event->getOption('skipOperation')) {
switch ($record->state()) { switch ($record->state()) {
case Doctrine_Record::STATE_TDIRTY: case Doctrine_Record::STATE_TDIRTY:
$this->insert($record); $this->insert($record);
...@@ -188,7 +188,7 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module ...@@ -188,7 +188,7 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module
$this->deleteComposites($record); $this->deleteComposites($record);
if ( ! $event->getSkipOperation()) { if ( ! $event->getOption('skipOperation')) {
$this->conn->transaction->addDelete($record); $this->conn->transaction->addDelete($record);
$record->state(Doctrine_Record::STATE_TCLEAN); $record->state(Doctrine_Record::STATE_TCLEAN);
...@@ -340,7 +340,7 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module ...@@ -340,7 +340,7 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module
$record->preUpdate($event); $record->preUpdate($event);
if ( ! $event->getSkipOperation()) { if ( ! $event->getOption('skipOperation')) {
$array = $record->getPrepared(); $array = $record->getPrepared();
if (empty($array)) { if (empty($array)) {
...@@ -399,7 +399,7 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module ...@@ -399,7 +399,7 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module
$record->preInsert($event); $record->preInsert($event);
if ( ! $event->getSkipOperation()) { if ( ! $event->getOption('skipOperation')) {
$array = $record->getPrepared(); $array = $record->getPrepared();
if (empty($array)) { if (empty($array)) {
......
...@@ -75,9 +75,9 @@ class Doctrine_Event ...@@ -75,9 +75,9 @@ class Doctrine_Event
*/ */
protected $_endedMicrotime; protected $_endedMicrotime;
/** /**
* @var boolean $skipOperation * @var array $_options an array of options
*/ */
protected $_skipOperation = false; protected $_options = array();
/** /**
* constructor * constructor
* *
...@@ -138,28 +138,50 @@ class Doctrine_Event ...@@ -138,28 +138,50 @@ class Doctrine_Event
return $this->_code; 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 * start
* starts the internal timer of this event * starts the internal timer of this event
* *
* @return void * @return Doctrine_Event this object
*/ */
public function start() public function start()
{ {
...@@ -179,11 +201,13 @@ class Doctrine_Event ...@@ -179,11 +201,13 @@ class Doctrine_Event
* end * end
* ends the internal timer of this event * ends the internal timer of this event
* *
* @return void * @return Doctrine_Event this object
*/ */
public function end() public function end()
{ {
$this->_endedMicrotime = microtime(true); $this->_endedMicrotime = microtime(true);
return $this;
} }
/** /**
* getInvoker * 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