mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
34 lines
590 B
PHP
Executable File
34 lines
590 B
PHP
Executable File
<?php
|
|
/**
|
|
* Contents of an UserDefinedForm submission
|
|
*
|
|
* @package userforms
|
|
*/
|
|
|
|
class SubmittedForm extends DataObject {
|
|
|
|
static $has_one = array(
|
|
"SubmittedBy" => "Member",
|
|
"Parent" => "UserDefinedForm",
|
|
);
|
|
|
|
static $has_many = array(
|
|
"Values" => "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->Values()) {
|
|
foreach($this->Values() as $value) {
|
|
$value->delete();
|
|
}
|
|
}
|
|
|
|
parent::onBeforeDelete();
|
|
}
|
|
} |