From daab8f4cbc25825b69a087bd942674d0d692e425 Mon Sep 17 00:00:00 2001 From: Andrew O'Neil Date: Wed, 11 Apr 2012 17:00:57 +1200 Subject: [PATCH] MINOR: Consistently use DataObjectInterface for saveInto() on FormField subclasses. Fixes E_STRICT notice --- forms/CheckboxSetField.php | 2 +- forms/ConfirmedPasswordField.php | 2 +- forms/FileField.php | 2 +- forms/HasManyComplexTableField.php | 2 +- forms/HasOneComplexTableField.php | 2 +- forms/HtmlEditorField.php | 2 +- forms/ListboxField.php | 2 +- forms/MoneyField.php | 2 +- forms/PhoneNumberField.php | 3 +-- forms/TableField.php | 2 +- forms/TreeMultiselectField.php | 2 +- security/PermissionCheckboxSetField.php | 2 +- 12 files changed, 12 insertions(+), 13 deletions(-) diff --git a/forms/CheckboxSetField.php b/forms/CheckboxSetField.php index 3bf1289cd..1c4650b2a 100644 --- a/forms/CheckboxSetField.php +++ b/forms/CheckboxSetField.php @@ -175,7 +175,7 @@ class CheckboxSetField extends OptionsetField { * * @param DataObject $record The record to save into */ - function saveInto(DataObject $record) { + function saveInto(DataObjectInterface $record) { $fieldname = $this->name; $relation = ($fieldname && $record && $record->hasMethod($fieldname)) ? $record->$fieldname() : null; if($fieldname && $record && $relation && $relation instanceof RelationList) { diff --git a/forms/ConfirmedPasswordField.php b/forms/ConfirmedPasswordField.php index 0e51215f5..cb2087019 100644 --- a/forms/ConfirmedPasswordField.php +++ b/forms/ConfirmedPasswordField.php @@ -286,7 +286,7 @@ class ConfirmedPasswordField extends FormField { * @param DataObject $record * @return bool */ - function saveInto(DataObject $record) { + function saveInto(DataObjectInterface $record) { if(!$this->isSaveable()) return false; if(!($this->canBeEmpty && !$this->value)) { diff --git a/forms/FileField.php b/forms/FileField.php index 83027f2c2..edc365218 100644 --- a/forms/FileField.php +++ b/forms/FileField.php @@ -123,7 +123,7 @@ class FileField extends FormField { ); } - public function saveInto(DataObject $record) { + public function saveInto(DataObjectInterface $record) { if(!isset($_FILES[$this->name])) return false; $fileClass = File::get_class_for_file_extension(pathinfo($_FILES[$this->name]['name'], PATHINFO_EXTENSION)); diff --git a/forms/HasManyComplexTableField.php b/forms/HasManyComplexTableField.php index 625734585..9f6c660d4 100644 --- a/forms/HasManyComplexTableField.php +++ b/forms/HasManyComplexTableField.php @@ -87,7 +87,7 @@ class HasManyComplexTableField extends ComplexTableField { return $this->controller->ID; } - function saveInto(DataObject $record) { + function saveInto(DataObjectInterface $record) { $fieldName = $this->name; $saveDest = $record->$fieldName(); diff --git a/forms/HasOneComplexTableField.php b/forms/HasOneComplexTableField.php index 8e2164692..06ee301e1 100644 --- a/forms/HasOneComplexTableField.php +++ b/forms/HasOneComplexTableField.php @@ -47,7 +47,7 @@ class HasOneComplexTableField extends HasManyComplexTableField { return $this->controller->{$this->joinField}; } - function saveInto(DataObject $record) { + function saveInto(DataObjectInterface $record) { $fieldName = $this->name; $fieldNameID = $fieldName . 'ID'; diff --git a/forms/HtmlEditorField.php b/forms/HtmlEditorField.php index 283f5e063..290a96bcb 100644 --- a/forms/HtmlEditorField.php +++ b/forms/HtmlEditorField.php @@ -96,7 +96,7 @@ class HtmlEditorField extends TextareaField { ); } - public function saveInto($record) { + public function saveInto(DataObjectInterface $record) { if($record->escapeTypeForField($this->name) != 'xml') { throw new Exception ( 'HtmlEditorField->saveInto(): This field should save into a HTMLText or HTMLVarchar field.' diff --git a/forms/ListboxField.php b/forms/ListboxField.php index 5ad9d7460..0c07535c1 100644 --- a/forms/ListboxField.php +++ b/forms/ListboxField.php @@ -169,7 +169,7 @@ class ListboxField extends DropdownField { * * @param DataObject $record The record to save into */ - function saveInto(DataObject $record) { + function saveInto(DataObjectInterface $record) { if($this->multiple) { $fieldname = $this->name; $relation = ($fieldname && $record && $record->hasMethod($fieldname)) ? $record->$fieldname() : null; diff --git a/forms/MoneyField.php b/forms/MoneyField.php index b0ae5c78b..eab6aefba 100644 --- a/forms/MoneyField.php +++ b/forms/MoneyField.php @@ -100,7 +100,7 @@ class MoneyField extends FormField { * * (see @link MoneyFieldTest_CustomSetter_Object for more information) */ - function saveInto($dataObject) { + function saveInto(DataObjectInterface $dataObject) { $fieldName = $this->name; if($dataObject->hasMethod("set$fieldName")) { $dataObject->$fieldName = DBField::create_field('Money', array( diff --git a/forms/PhoneNumberField.php b/forms/PhoneNumberField.php index c15fb73f0..4e756f7a9 100644 --- a/forms/PhoneNumberField.php +++ b/forms/PhoneNumberField.php @@ -103,8 +103,7 @@ class PhoneNumberField extends FormField { return $parts; } - public function saveInto( $record ) { - + public function saveInto(DataObjectInterface $record) { list( $countryCode, $areaCode, $phoneNumber, $extension ) = $this->parseValue(); $fieldName = $this->name; diff --git a/forms/TableField.php b/forms/TableField.php index 89e20c15c..0f365bab2 100644 --- a/forms/TableField.php +++ b/forms/TableField.php @@ -231,7 +231,7 @@ class TableField extends TableListField { /** * Saves the Dataobjects contained in the field */ - function saveInto(DataObject $record) { + function saveInto(DataObjectInterface $record) { // CMS sometimes tries to set the value to one. if(is_array($this->value)){ $newFields = array(); diff --git a/forms/TreeMultiselectField.php b/forms/TreeMultiselectField.php index cdb09b0ef..bd2755417 100644 --- a/forms/TreeMultiselectField.php +++ b/forms/TreeMultiselectField.php @@ -132,7 +132,7 @@ class TreeMultiselectField extends TreeDropdownField { * Calls function $record->onChange($items) before saving to the assummed * Component set. */ - function saveInto(DataObject $record) { + function saveInto(DataObjectInterface $record) { // Detect whether this field has actually been updated if($this->value !== 'unchanged') { $items = array(); diff --git a/security/PermissionCheckboxSetField.php b/security/PermissionCheckboxSetField.php index 2095ec087..7c95c801e 100644 --- a/security/PermissionCheckboxSetField.php +++ b/security/PermissionCheckboxSetField.php @@ -215,7 +215,7 @@ class PermissionCheckboxSetField extends FormField { * * @param DataObject $record */ - function saveInto(DataObject $record) { + function saveInto(DataObjectInterface $record) { $fieldname = $this->name; $managedClass = $this->managedClass;