Skip to content
This repository
Browse code

API CHANGE: Updated throwExceptionOnBadDataType setter to be standard…

… setThrowExceptionOnBadDataType(), added getThrowExceptionOnBadDataType().
  • Loading branch information...
commit 7de5bf55e08b2e94958167be797b5b3d26a93e1e 1 parent f670576
Sam Minnée authored March 10, 2012
18  forms/gridfield/GridFieldConfig.php
@@ -137,9 +137,9 @@ public function __construct($itemsPerPage=null) {
137 137
 		$this->addComponent(new GridFieldDataColumns());
138 138
 		$this->addComponent($pagination = new GridFieldPaginator($itemsPerPage));
139 139
 
140  
-		$sort->throwExceptionOnBadDataType(false);
141  
-		$filter->throwExceptionOnBadDataType(false);
142  
-		$pagination->throwExceptionOnBadDataType(false);
  140
+		$sort->setThrowExceptionOnBadDataType(false);
  141
+		$filter->setThrowExceptionOnBadDataType(false);
  142
+		$pagination->setThrowExceptionOnBadDataType(false);
143 143
 	}
144 144
 }
145 145
 
@@ -172,9 +172,9 @@ public function __construct($itemsPerPage=null) {
172 172
 		$this->addComponent($pagination = new GridFieldPaginator($itemsPerPage));
173 173
 		$this->addComponent(new GridFieldDetailForm());
174 174
 
175  
-		$sort->throwExceptionOnBadDataType(false);
176  
-		$filter->throwExceptionOnBadDataType(false);
177  
-		$pagination->throwExceptionOnBadDataType(false);
  175
+		$sort->setThrowExceptionOnBadDataType(false);
  176
+		$filter->setThrowExceptionOnBadDataType(false);
  177
+		$pagination->setThrowExceptionOnBadDataType(false);
178 178
 	}
179 179
 }
180 180
 
@@ -220,8 +220,8 @@ public function __construct($itemsPerPage=null) {
220 220
 		$this->addComponent($pagination = new GridFieldPaginator($itemsPerPage));
221 221
 		$this->addComponent(new GridFieldDetailForm());
222 222
 
223  
-		$sort->throwExceptionOnBadDataType(false);
224  
-		$filter->throwExceptionOnBadDataType(false);
225  
-		$pagination->throwExceptionOnBadDataType(false);
  223
+		$sort->setThrowExceptionOnBadDataType(false);
  224
+		$filter->setThrowExceptionOnBadDataType(false);
  225
+		$pagination->setThrowExceptionOnBadDataType(false);
226 226
 	}
227 227
 }
11  forms/gridfield/GridFieldFilterHeader.php
@@ -10,7 +10,7 @@
10 10
 class GridFieldFilterHeader implements GridField_HTMLProvider, GridField_DataManipulator, GridField_ActionProvider {
11 11
 
12 12
 	/**
13  
-	 * See {@link throwExceptionOnBadDataType()}
  13
+	 * See {@link setThrowExceptionOnBadDataType()}
14 14
 	 */
15 15
 	protected $throwExceptionOnBadDataType = true;
16 16
 	
@@ -23,9 +23,16 @@ class GridFieldFilterHeader implements GridField_HTMLProvider, GridField_DataMan
23 23
 	 * By default, this is set to true so that it's clearer what's happening, but the predefined
24 24
 	 * {@link GridFieldConfig} subclasses set this to false for flexibility.
25 25
 	 */
26  
-	public function throwExceptionOnBadDataType($throwExceptionOnBadDataType) {
  26
+	public function setThrowExceptionOnBadDataType($throwExceptionOnBadDataType) {
27 27
 		$this->throwExceptionOnBadDataType = $throwExceptionOnBadDataType; 
28 28
 	}
  29
+
  30
+	/**
  31
+	 * See {@link setThrowExceptionOnBadDataType()}
  32
+	 */
  33
+	public function getThrowExceptionOnBadDataType() {
  34
+		return $this->throwExceptionOnBadDataType;
  35
+	}
29 36
 	
30 37
 	/**
31 38
 	 * Check that this dataList is of the right data type.
11  forms/gridfield/GridFieldPaginator.php
@@ -21,7 +21,7 @@ class GridFieldPaginator implements GridField_HTMLProvider, GridField_DataManipu
21 21
 	protected $itemClass = 'GridFieldPaginator_Row';
22 22
 
23 23
 	/**
24  
-	 * See {@link throwExceptionOnBadDataType()}
  24
+	 * See {@link setThrowExceptionOnBadDataType()}
25 25
 	 */
26 26
 	protected $throwExceptionOnBadDataType = true;
27 27
 
@@ -42,9 +42,16 @@ public function __construct($itemsPerPage=null) {
42 42
 	 * By default, this is set to true so that it's clearer what's happening, but the predefined
43 43
 	 * {@link GridFieldConfig} subclasses set this to false for flexibility.
44 44
 	 */
45  
-	public function throwExceptionOnBadDataType($throwExceptionOnBadDataType) {
  45
+	public function setThrowExceptionOnBadDataType($throwExceptionOnBadDataType) {
46 46
 		$this->throwExceptionOnBadDataType = $throwExceptionOnBadDataType; 
47 47
 	}
  48
+
  49
+	/**
  50
+	 * See {@link setThrowExceptionOnBadDataType()}
  51
+	 */
  52
+	public function getThrowExceptionOnBadDataType() {
  53
+		return $this->throwExceptionOnBadDataType;
  54
+	}
48 55
 	
49 56
 	/**
50 57
 	 * Check that this dataList is of the right data type.
11  forms/gridfield/GridFieldSortableHeader.php
@@ -10,7 +10,7 @@
10 10
 class GridFieldSortableHeader implements GridField_HTMLProvider, GridField_DataManipulator, GridField_ActionProvider {
11 11
 
12 12
 	/**
13  
-	 * See {@link throwExceptionOnBadDataType()}
  13
+	 * See {@link setThrowExceptionOnBadDataType()}
14 14
 	 */
15 15
 	protected $throwExceptionOnBadDataType = true;
16 16
 	
@@ -23,9 +23,16 @@ class GridFieldSortableHeader implements GridField_HTMLProvider, GridField_DataM
23 23
 	 * By default, this is set to true so that it's clearer what's happening, but the predefined
24 24
 	 * {@link GridFieldConfig} subclasses set this to false for flexibility.
25 25
 	 */
26  
-	public function throwExceptionOnBadDataType($throwExceptionOnBadDataType) {
  26
+	public function setThrowExceptionOnBadDataType($throwExceptionOnBadDataType) {
27 27
 		$this->throwExceptionOnBadDataType = $throwExceptionOnBadDataType; 
28 28
 	}
  29
+
  30
+	/**
  31
+	 * See {@link setThrowExceptionOnBadDataType()}
  32
+	 */
  33
+	public function getThrowExceptionOnBadDataType() {
  34
+		return $this->throwExceptionOnBadDataType;
  35
+	}
29 36
 	
30 37
 	/**
31 38
 	 * Check that this dataList is of the right data type.
6  tests/forms/GridFieldTest.php
@@ -36,9 +36,9 @@ public function testGridFieldDefaultConfig() {
36 36
 			$pagination = new GridFieldPaginator(),
37 37
 			new GridState_Component(),
38 38
 		));
39  
-		$sort->throwExceptionOnBadDataType(false);
40  
-		$filter->throwExceptionOnBadDataType(false);
41  
-		$pagination->throwExceptionOnBadDataType(false);
  39
+		$sort->setThrowExceptionOnBadDataType(false);
  40
+		$filter->setThrowExceptionOnBadDataType(false);
  41
+		$pagination->setThrowExceptionOnBadDataType(false);
42 42
 		
43 43
 		$this->assertEquals($expectedComponents, $obj->getConfig()->getComponents(), 'Testing default Config');
44 44
 	}

0 notes on commit 7de5bf5

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