Skip to content
This repository
Browse code

MINOR: Consistently use DataObjectInterface for saveInto() on FormFie…

…ld subclasses. Fixes E_STRICT notice
  • Loading branch information...
commit daab8f4cbc25825b69a087bd942674d0d692e425 1 parent f811103
Andrew O'Neil authored April 11, 2012
2  forms/CheckboxSetField.php
@@ -175,7 +175,7 @@ function setValue($value, $obj = null) {
175 175
 	 *
176 176
 	 * @param DataObject $record The record to save into
177 177
 	 */
178  
-	function saveInto(DataObject $record) {
  178
+	function saveInto(DataObjectInterface $record) {
179 179
 		$fieldname = $this->name;
180 180
 		$relation = ($fieldname && $record && $record->hasMethod($fieldname)) ? $record->$fieldname() : null;
181 181
 		if($fieldname && $record && $relation && $relation instanceof RelationList) {
2  forms/ConfirmedPasswordField.php
@@ -286,7 +286,7 @@ function validate() {
286 286
 	 * @param DataObject $record
287 287
 	 * @return bool
288 288
 	 */
289  
-	function saveInto(DataObject $record) {
  289
+	function saveInto(DataObjectInterface $record) {
290 290
 		if(!$this->isSaveable()) return false;
291 291
 		
292 292
 		if(!($this->canBeEmpty && !$this->value)) {
2  forms/FileField.php
@@ -123,7 +123,7 @@ function getAttributes() {
123 123
 		);
124 124
 	}
125 125
 
126  
-	public function saveInto(DataObject $record) {
  126
+	public function saveInto(DataObjectInterface $record) {
127 127
 		if(!isset($_FILES[$this->name])) return false;
128 128
 		$fileClass = File::get_class_for_file_extension(pathinfo($_FILES[$this->name]['name'], PATHINFO_EXTENSION));
129 129
 		
2  forms/HasManyComplexTableField.php
@@ -87,7 +87,7 @@ function getControllerID() {
87 87
 		return $this->controller->ID;
88 88
 	}
89 89
 	
90  
-	function saveInto(DataObject $record) {
  90
+	function saveInto(DataObjectInterface $record) {
91 91
 		$fieldName = $this->name;
92 92
 		$saveDest = $record->$fieldName();
93 93
 		
2  forms/HasOneComplexTableField.php
@@ -47,7 +47,7 @@ function getControllerJoinID() {
47 47
 		return $this->controller->{$this->joinField};
48 48
 	}
49 49
 	
50  
-	function saveInto(DataObject $record) {
  50
+	function saveInto(DataObjectInterface $record) {
51 51
 		$fieldName = $this->name;
52 52
 		$fieldNameID = $fieldName . 'ID';
53 53
 		
2  forms/HtmlEditorField.php
@@ -96,7 +96,7 @@ function getAttributes() {
96 96
 		);
97 97
 	}
98 98
 	
99  
-	public function saveInto($record) {
  99
+	public function saveInto(DataObjectInterface $record) {
100 100
 		if($record->escapeTypeForField($this->name) != 'xml') {
101 101
 			throw new Exception (
102 102
 				'HtmlEditorField->saveInto(): This field should save into a HTMLText or HTMLVarchar field.'
2  forms/ListboxField.php
@@ -169,7 +169,7 @@ function dataValue() {
169 169
 	 *
170 170
 	 * @param DataObject $record The record to save into
171 171
 	 */
172  
-	function saveInto(DataObject $record) {
  172
+	function saveInto(DataObjectInterface $record) {
173 173
 		if($this->multiple) {
174 174
 			$fieldname = $this->name;
175 175
 			$relation = ($fieldname && $record && $record->hasMethod($fieldname)) ? $record->$fieldname() : null;
2  forms/MoneyField.php
@@ -100,7 +100,7 @@ function setValue($val) {
100 100
 	 *
101 101
 	 * (see @link MoneyFieldTest_CustomSetter_Object for more information)
102 102
 	 */
103  
-	function saveInto($dataObject) {
  103
+	function saveInto(DataObjectInterface $dataObject) {
104 104
 		$fieldName = $this->name;
105 105
 		if($dataObject->hasMethod("set$fieldName")) {
106 106
 			$dataObject->$fieldName = DBField::create_field('Money', array(
3  forms/PhoneNumberField.php
@@ -103,8 +103,7 @@ protected function parseValue() {
103 103
 		return $parts;
104 104
 	}
105 105
 	
106  
-	public function saveInto( $record ) {
107  
-    
  106
+	public function saveInto(DataObjectInterface $record) {
108 107
 		list( $countryCode, $areaCode, $phoneNumber, $extension ) = $this->parseValue();
109 108
 		$fieldName = $this->name;
110 109
 		
2  forms/TableField.php
@@ -231,7 +231,7 @@ function FieldList() {
231 231
 	/** 
232 232
 	 * Saves the Dataobjects contained in the field
233 233
 	 */
234  
-	function saveInto(DataObject $record) {
  234
+	function saveInto(DataObjectInterface $record) {
235 235
 		// CMS sometimes tries to set the value to one.
236 236
 		if(is_array($this->value)){
237 237
 			$newFields = array();
2  forms/TreeMultiselectField.php
@@ -132,7 +132,7 @@ function Field() {
132 132
 	 * Calls function $record->onChange($items) before saving to the assummed 
133 133
 	 * Component set.
134 134
 	 */
135  
-	function saveInto(DataObject $record) {
  135
+	function saveInto(DataObjectInterface $record) {
136 136
 		// Detect whether this field has actually been updated
137 137
 		if($this->value !== 'unchanged') {
138 138
 			$items = array();
2  security/PermissionCheckboxSetField.php
@@ -215,7 +215,7 @@ function Field() {
215 215
 	 *
216 216
 	 * @param DataObject $record
217 217
 	 */
218  
-	function saveInto(DataObject $record) {
  218
+	function saveInto(DataObjectInterface $record) {
219 219
 		$fieldname = $this->name;
220 220
 		$managedClass = $this->managedClass;
221 221
 

0 notes on commit daab8f4

Please sign in to comment.
Something went wrong with that request. Please try again.