1
0
mirror of synced 2025-02-01 13:01:45 +03:00

fixed delete state handling

This commit is contained in:
zYne 2007-05-23 20:41:03 +00:00
parent 01d8e55bd0
commit 8c54e8d736
2 changed files with 11 additions and 8 deletions

View File

@ -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;

View File

@ -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) {