Version: current

     1 <?php
     2 /**
     3  * Contents of an UserDefinedForm submission
     4  *
     5  * @package userforms
     6  */
     7
     8 class SubmittedForm extends DataObject {
     9
    10     static $has_one = array(
    11         "SubmittedBy" => "Member",
    12         "Parent" => "UserDefinedForm",
    13     );
    14
    15     static $has_many = array(
    16         "Values" => "SubmittedFormField"
    17     );
    18
    19     /**
    20      * Before we delete this form make sure we delete all the
    21      * field values so that we don't leave old data round
    22      *
    23      */
    24     protected function onBeforeDelete() {
    25
    26         if($this->Values()) {
    27             foreach($this->Values() as $value) {
    28                 $value->delete();
    29             }
    30         }
    31
    32         parent::onBeforeDelete();
    33     }
    34 }

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -