mirror of
https://github.com/silverstripe/silverstripe-multiform
synced 2024-10-22 11:05:49 +02:00
Remove the relation as well as delete the object
This commit is contained in:
parent
652c0af4c2
commit
626c272b6f
@ -41,9 +41,10 @@ class MultiFormSession extends DataObject {
|
|||||||
* These actions are performed when delete() is called on this object.
|
* These actions are performed when delete() is called on this object.
|
||||||
*/
|
*/
|
||||||
public function onBeforeDelete() {
|
public function onBeforeDelete() {
|
||||||
// delete dependent form steps
|
// delete dependent form steps and relation
|
||||||
$steps = $this->FormSteps();
|
$steps = $this->FormSteps();
|
||||||
if($steps) foreach($steps as $step) {
|
if($steps) foreach($steps as $step) {
|
||||||
|
$steps->remove($step);
|
||||||
$step->delete();
|
$step->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user