Commit 8c54e8d7 authored by zYne's avatar zYne

fixed delete state handling

parent 01d8e55b
......@@ -1026,6 +1026,8 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
$record->getTable()->getListener()->onDelete($record);
$record->state(Doctrine_Record::STATE_TCLEAN);
$this->commit();
return true;
......
......@@ -69,11 +69,6 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
* a Doctrine_Record turns into deleted state when it is deleted
*/
const STATE_DELETED = 6;
/**
* the following protected variables use '_' prefixes, the reason for this is to allow child
* classes call for example $this->id, $this->state for getting the values of columns named 'id' and 'state'
* rather than the values of these protected variables
*/
/**
* @var object Doctrine_Table $_table the factory that created this data access object
*/
......@@ -526,7 +521,6 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
}
$err = false;
if (is_integer($state)) {
if ($state >= 1 && $state <= 6) {
$this->_state = $state;
} else {
......@@ -548,8 +542,15 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
}
}
if ($err)
if ($this->_state === Doctrine_Record::STATE_TCLEAN ||
$this->_state === Doctrine_Record::STATE_CLEAN) {
$this->_modified = array();
}
if ($err) {
throw new Doctrine_Record_State_Exception('Unknown record state ' . $state);
}
}
/**
* refresh
......@@ -779,7 +780,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
if ($value === null) {
$value = self::$_null;
}
$this->_data[$lower] = $value;
$this->_modified[] = $lower;
switch ($this->_state) {
......
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