MINOR: Consistently use DataObjectInterface for saveInto() on FormField subclasses. Fixes E_STRICT notice

This commit is contained in:
Andrew O'Neil 2012-04-11 17:00:57 +12:00
parent f811103243
commit daab8f4cbc
12 changed files with 12 additions and 13 deletions

View File

@ -175,7 +175,7 @@ class CheckboxSetField extends OptionsetField {
* *
* @param DataObject $record The record to save into * @param DataObject $record The record to save into
*/ */
function saveInto(DataObject $record) { function saveInto(DataObjectInterface $record) {
$fieldname = $this->name; $fieldname = $this->name;
$relation = ($fieldname && $record && $record->hasMethod($fieldname)) ? $record->$fieldname() : null; $relation = ($fieldname && $record && $record->hasMethod($fieldname)) ? $record->$fieldname() : null;
if($fieldname && $record && $relation && $relation instanceof RelationList) { if($fieldname && $record && $relation && $relation instanceof RelationList) {

View File

@ -286,7 +286,7 @@ class ConfirmedPasswordField extends FormField {
* @param DataObject $record * @param DataObject $record
* @return bool * @return bool
*/ */
function saveInto(DataObject $record) { function saveInto(DataObjectInterface $record) {
if(!$this->isSaveable()) return false; if(!$this->isSaveable()) return false;
if(!($this->canBeEmpty && !$this->value)) { if(!($this->canBeEmpty && !$this->value)) {

View File

@ -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; if(!isset($_FILES[$this->name])) return false;
$fileClass = File::get_class_for_file_extension(pathinfo($_FILES[$this->name]['name'], PATHINFO_EXTENSION)); $fileClass = File::get_class_for_file_extension(pathinfo($_FILES[$this->name]['name'], PATHINFO_EXTENSION));

View File

@ -87,7 +87,7 @@ class HasManyComplexTableField extends ComplexTableField {
return $this->controller->ID; return $this->controller->ID;
} }
function saveInto(DataObject $record) { function saveInto(DataObjectInterface $record) {
$fieldName = $this->name; $fieldName = $this->name;
$saveDest = $record->$fieldName(); $saveDest = $record->$fieldName();

View File

@ -47,7 +47,7 @@ class HasOneComplexTableField extends HasManyComplexTableField {
return $this->controller->{$this->joinField}; return $this->controller->{$this->joinField};
} }
function saveInto(DataObject $record) { function saveInto(DataObjectInterface $record) {
$fieldName = $this->name; $fieldName = $this->name;
$fieldNameID = $fieldName . 'ID'; $fieldNameID = $fieldName . 'ID';

View File

@ -96,7 +96,7 @@ class HtmlEditorField extends TextareaField {
); );
} }
public function saveInto($record) { public function saveInto(DataObjectInterface $record) {
if($record->escapeTypeForField($this->name) != 'xml') { if($record->escapeTypeForField($this->name) != 'xml') {
throw new Exception ( throw new Exception (
'HtmlEditorField->saveInto(): This field should save into a HTMLText or HTMLVarchar field.' 'HtmlEditorField->saveInto(): This field should save into a HTMLText or HTMLVarchar field.'

View File

@ -169,7 +169,7 @@ class ListboxField extends DropdownField {
* *
* @param DataObject $record The record to save into * @param DataObject $record The record to save into
*/ */
function saveInto(DataObject $record) { function saveInto(DataObjectInterface $record) {
if($this->multiple) { if($this->multiple) {
$fieldname = $this->name; $fieldname = $this->name;
$relation = ($fieldname && $record && $record->hasMethod($fieldname)) ? $record->$fieldname() : null; $relation = ($fieldname && $record && $record->hasMethod($fieldname)) ? $record->$fieldname() : null;

View File

@ -100,7 +100,7 @@ class MoneyField extends FormField {
* *
* (see @link MoneyFieldTest_CustomSetter_Object for more information) * (see @link MoneyFieldTest_CustomSetter_Object for more information)
*/ */
function saveInto($dataObject) { function saveInto(DataObjectInterface $dataObject) {
$fieldName = $this->name; $fieldName = $this->name;
if($dataObject->hasMethod("set$fieldName")) { if($dataObject->hasMethod("set$fieldName")) {
$dataObject->$fieldName = DBField::create_field('Money', array( $dataObject->$fieldName = DBField::create_field('Money', array(

View File

@ -103,8 +103,7 @@ class PhoneNumberField extends FormField {
return $parts; return $parts;
} }
public function saveInto( $record ) { public function saveInto(DataObjectInterface $record) {
list( $countryCode, $areaCode, $phoneNumber, $extension ) = $this->parseValue(); list( $countryCode, $areaCode, $phoneNumber, $extension ) = $this->parseValue();
$fieldName = $this->name; $fieldName = $this->name;

View File

@ -231,7 +231,7 @@ class TableField extends TableListField {
/** /**
* Saves the Dataobjects contained in the field * Saves the Dataobjects contained in the field
*/ */
function saveInto(DataObject $record) { function saveInto(DataObjectInterface $record) {
// CMS sometimes tries to set the value to one. // CMS sometimes tries to set the value to one.
if(is_array($this->value)){ if(is_array($this->value)){
$newFields = array(); $newFields = array();

View File

@ -132,7 +132,7 @@ class TreeMultiselectField extends TreeDropdownField {
* Calls function $record->onChange($items) before saving to the assummed * Calls function $record->onChange($items) before saving to the assummed
* Component set. * Component set.
*/ */
function saveInto(DataObject $record) { function saveInto(DataObjectInterface $record) {
// Detect whether this field has actually been updated // Detect whether this field has actually been updated
if($this->value !== 'unchanged') { if($this->value !== 'unchanged') {
$items = array(); $items = array();

View File

@ -215,7 +215,7 @@ class PermissionCheckboxSetField extends FormField {
* *
* @param DataObject $record * @param DataObject $record
*/ */
function saveInto(DataObject $record) { function saveInto(DataObjectInterface $record) {
$fieldname = $this->name; $fieldname = $this->name;
$managedClass = $this->managedClass; $managedClass = $this->managedClass;