From 7de5bf55e08b2e94958167be797b5b3d26a93e1e Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Sat, 10 Mar 2012 14:44:12 +1300 Subject: [PATCH] API CHANGE: Updated throwExceptionOnBadDataType setter to be standard setThrowExceptionOnBadDataType(), added getThrowExceptionOnBadDataType(). --- forms/gridfield/GridFieldConfig.php | 18 +++++++++--------- forms/gridfield/GridFieldFilterHeader.php | 11 +++++++++-- forms/gridfield/GridFieldPaginator.php | 11 +++++++++-- forms/gridfield/GridFieldSortableHeader.php | 11 +++++++++-- tests/forms/GridFieldTest.php | 6 +++--- 5 files changed, 39 insertions(+), 18 deletions(-) diff --git a/forms/gridfield/GridFieldConfig.php b/forms/gridfield/GridFieldConfig.php index 2d7852774..2a17054f5 100755 --- a/forms/gridfield/GridFieldConfig.php +++ b/forms/gridfield/GridFieldConfig.php @@ -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); } } diff --git a/forms/gridfield/GridFieldFilterHeader.php b/forms/gridfield/GridFieldFilterHeader.php index b59c38ee6..3f409a356 100644 --- a/forms/gridfield/GridFieldFilterHeader.php +++ b/forms/gridfield/GridFieldFilterHeader.php @@ -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. diff --git a/forms/gridfield/GridFieldPaginator.php b/forms/gridfield/GridFieldPaginator.php index 282d50495..9945d1e03 100755 --- a/forms/gridfield/GridFieldPaginator.php +++ b/forms/gridfield/GridFieldPaginator.php @@ -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. diff --git a/forms/gridfield/GridFieldSortableHeader.php b/forms/gridfield/GridFieldSortableHeader.php index e52138864..255a91953 100644 --- a/forms/gridfield/GridFieldSortableHeader.php +++ b/forms/gridfield/GridFieldSortableHeader.php @@ -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. diff --git a/tests/forms/GridFieldTest.php b/tests/forms/GridFieldTest.php index 24334b0ed..7c5c424be 100644 --- a/tests/forms/GridFieldTest.php +++ b/tests/forms/GridFieldTest.php @@ -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'); }