API CHANGE: Updated throwExceptionOnBadDataType setter to be standard setThrowExceptionOnBadDataType(), added getThrowExceptionOnBadDataType().

This commit is contained in:
Sam Minnee 2012-03-10 14:44:12 +13:00
parent f670576cad
commit 7de5bf55e0
5 changed files with 39 additions and 18 deletions

View File

@ -137,9 +137,9 @@ class GridFieldConfig_Base extends GridFieldConfig {
$this->addComponent(new GridFieldDataColumns());
$this->addComponent($pagination = new GridFieldPaginator($itemsPerPage));
$sort->throwExceptionOnBadDataType(false);
$filter->throwExceptionOnBadDataType(false);
$pagination->throwExceptionOnBadDataType(false);
$sort->setThrowExceptionOnBadDataType(false);
$filter->setThrowExceptionOnBadDataType(false);
$pagination->setThrowExceptionOnBadDataType(false);
}
}
@ -172,9 +172,9 @@ class GridFieldConfig_RecordEditor extends GridFieldConfig {
$this->addComponent($pagination = new GridFieldPaginator($itemsPerPage));
$this->addComponent(new GridFieldDetailForm());
$sort->throwExceptionOnBadDataType(false);
$filter->throwExceptionOnBadDataType(false);
$pagination->throwExceptionOnBadDataType(false);
$sort->setThrowExceptionOnBadDataType(false);
$filter->setThrowExceptionOnBadDataType(false);
$pagination->setThrowExceptionOnBadDataType(false);
}
}
@ -220,8 +220,8 @@ class GridFieldConfig_RelationEditor extends GridFieldConfig {
$this->addComponent($pagination = new GridFieldPaginator($itemsPerPage));
$this->addComponent(new GridFieldDetailForm());
$sort->throwExceptionOnBadDataType(false);
$filter->throwExceptionOnBadDataType(false);
$pagination->throwExceptionOnBadDataType(false);
$sort->setThrowExceptionOnBadDataType(false);
$filter->setThrowExceptionOnBadDataType(false);
$pagination->setThrowExceptionOnBadDataType(false);
}
}

View File

@ -10,7 +10,7 @@
class GridFieldFilterHeader implements GridField_HTMLProvider, GridField_DataManipulator, GridField_ActionProvider {
/**
* See {@link throwExceptionOnBadDataType()}
* See {@link setThrowExceptionOnBadDataType()}
*/
protected $throwExceptionOnBadDataType = true;
@ -23,9 +23,16 @@ class GridFieldFilterHeader implements GridField_HTMLProvider, GridField_DataMan
* By default, this is set to true so that it's clearer what's happening, but the predefined
* {@link GridFieldConfig} subclasses set this to false for flexibility.
*/
public function throwExceptionOnBadDataType($throwExceptionOnBadDataType) {
public function setThrowExceptionOnBadDataType($throwExceptionOnBadDataType) {
$this->throwExceptionOnBadDataType = $throwExceptionOnBadDataType;
}
/**
* See {@link setThrowExceptionOnBadDataType()}
*/
public function getThrowExceptionOnBadDataType() {
return $this->throwExceptionOnBadDataType;
}
/**
* Check that this dataList is of the right data type.

View File

@ -21,7 +21,7 @@ class GridFieldPaginator implements GridField_HTMLProvider, GridField_DataManipu
protected $itemClass = 'GridFieldPaginator_Row';
/**
* See {@link throwExceptionOnBadDataType()}
* See {@link setThrowExceptionOnBadDataType()}
*/
protected $throwExceptionOnBadDataType = true;
@ -42,9 +42,16 @@ class GridFieldPaginator implements GridField_HTMLProvider, GridField_DataManipu
* By default, this is set to true so that it's clearer what's happening, but the predefined
* {@link GridFieldConfig} subclasses set this to false for flexibility.
*/
public function throwExceptionOnBadDataType($throwExceptionOnBadDataType) {
public function setThrowExceptionOnBadDataType($throwExceptionOnBadDataType) {
$this->throwExceptionOnBadDataType = $throwExceptionOnBadDataType;
}
/**
* See {@link setThrowExceptionOnBadDataType()}
*/
public function getThrowExceptionOnBadDataType() {
return $this->throwExceptionOnBadDataType;
}
/**
* Check that this dataList is of the right data type.

View File

@ -10,7 +10,7 @@
class GridFieldSortableHeader implements GridField_HTMLProvider, GridField_DataManipulator, GridField_ActionProvider {
/**
* See {@link throwExceptionOnBadDataType()}
* See {@link setThrowExceptionOnBadDataType()}
*/
protected $throwExceptionOnBadDataType = true;
@ -23,9 +23,16 @@ class GridFieldSortableHeader implements GridField_HTMLProvider, GridField_DataM
* By default, this is set to true so that it's clearer what's happening, but the predefined
* {@link GridFieldConfig} subclasses set this to false for flexibility.
*/
public function throwExceptionOnBadDataType($throwExceptionOnBadDataType) {
public function setThrowExceptionOnBadDataType($throwExceptionOnBadDataType) {
$this->throwExceptionOnBadDataType = $throwExceptionOnBadDataType;
}
/**
* See {@link setThrowExceptionOnBadDataType()}
*/
public function getThrowExceptionOnBadDataType() {
return $this->throwExceptionOnBadDataType;
}
/**
* Check that this dataList is of the right data type.

View File

@ -36,9 +36,9 @@ class GridFieldTest extends SapphireTest {
$pagination = new GridFieldPaginator(),
new GridState_Component(),
));
$sort->throwExceptionOnBadDataType(false);
$filter->throwExceptionOnBadDataType(false);
$pagination->throwExceptionOnBadDataType(false);
$sort->setThrowExceptionOnBadDataType(false);
$filter->setThrowExceptionOnBadDataType(false);
$pagination->setThrowExceptionOnBadDataType(false);
$this->assertEquals($expectedComponents, $obj->getConfig()->getComponents(), 'Testing default Config');
}