Add getEditableField() helper

This commit is contained in:
Will Rossiter 2014-08-11 11:12:00 +12:00
parent 23963e2a47
commit e8e41826da

View File

@ -78,4 +78,20 @@ class SubmittedFormField extends DataObject {
public function getExportValue() {
return $this->Value;
}
/**
* Find equivalent editable field for this submission.
*
* Note the field may have been modified or deleted from the original form
* so this may not always return the data you expect. If you need to save
* a particular state of editable form field at time of submission, copy
* that value to the submission.
*
* @return EditableFormField
*/
public function getEditableField() {
return $this->Parent()->Parent()->Fields()->filter(array(
'Name' => $this->Name
))->First();
}
}