fixed delete state handling
This commit is contained in:
parent
01d8e55bd0
commit
8c54e8d736
@ -1026,6 +1026,8 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
|||||||
|
|
||||||
$record->getTable()->getListener()->onDelete($record);
|
$record->getTable()->getListener()->onDelete($record);
|
||||||
|
|
||||||
|
$record->state(Doctrine_Record::STATE_TCLEAN);
|
||||||
|
|
||||||
$this->commit();
|
$this->commit();
|
||||||
|
|
||||||
return true;
|
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
|
* a Doctrine_Record turns into deleted state when it is deleted
|
||||||
*/
|
*/
|
||||||
const STATE_DELETED = 6;
|
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
|
* @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;
|
$err = false;
|
||||||
if (is_integer($state)) {
|
if (is_integer($state)) {
|
||||||
|
|
||||||
if ($state >= 1 && $state <= 6) {
|
if ($state >= 1 && $state <= 6) {
|
||||||
$this->_state = $state;
|
$this->_state = $state;
|
||||||
} else {
|
} else {
|
||||||
@ -548,9 +542,16 @@ 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);
|
throw new Doctrine_Record_State_Exception('Unknown record state ' . $state);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* refresh
|
* refresh
|
||||||
* refresh internal data from the database
|
* refresh internal data from the database
|
||||||
|
Loading…
x
Reference in New Issue
Block a user