BUGFIX If the step doesn't exist, don't attempt to delete it

This commit is contained in:
Sean Harvey 2009-04-27 23:13:21 +00:00
parent 3690de6943
commit 04130ad501

View File

@ -55,9 +55,11 @@ class MultiFormSession extends DataObject {
// delete dependent form steps and relation
$steps = $this->FormSteps();
if($steps) foreach($steps as $step) {
$steps->remove($step); // @TODO not sure if this is required (does delete() remove the relation too?)
$step->destroy();
if($step && $step->exists()) {
$steps->remove($step);
$step->delete();
$step->destroy();
}
}
parent::onBeforeDelete();