mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
MINOR: Consistently use DataObjectInterface for saveInto() on FormField subclasses. Fixes E_STRICT notice
This commit is contained in:
parent
f811103243
commit
daab8f4cbc
@ -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) {
|
||||||
|
@ -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)) {
|
||||||
|
@ -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));
|
||||||
|
|
||||||
|
@ -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();
|
||||||
|
|
||||||
|
@ -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';
|
||||||
|
|
||||||
|
@ -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.'
|
||||||
|
@ -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;
|
||||||
|
@ -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(
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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();
|
||||||
|
@ -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();
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user