silverstripe-userforms/code/editor/SubmittedForm.php

30 lines
590 B
PHP
Raw Normal View History

<?php
/**
* Contents of an UserDefinedForm submission
* @package cms
*/
class SubmittedForm extends DataObject {
static $has_one = array(
"SubmittedBy" => "Member",
"Parent" => "UserDefinedForm",
);
static $has_many = array(
"FieldValues" => "SubmittedFormField"
);
/**
* Before we delete this form make sure we delete all the
* field values so that we don't leave old data round
*
*/
protected function onBeforeDelete() {
if($this->FieldValues()) {
foreach($this->FieldValues() as $value) {
$value->delete();
}
}
parent::onBeforeDelete();
}
}
?>