From 20da27f7ddf868bea39a62a6bf17c009d093c7b6 Mon Sep 17 00:00:00 2001 From: UndefinedOffset Date: Thu, 1 Mar 2018 10:45:44 -0400 Subject: [PATCH] Fixed potential issue with DBInt --- CHANGELOG.md | 3 +++ src/Forms/GridFieldSortableRows.php | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 65c5891..616e876 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Change Log +## [2.0.3](https://github.com/UndefinedOffset/SortableGridField/tree/2.0.3) (2018-03-01) +[Full Changelog](https://github.com/UndefinedOffset/SortableGridField/compare/2.0.2...2.0.3) + ## [2.0.2](https://github.com/UndefinedOffset/SortableGridField/tree/2.0.2) (2017-12-11) [Full Changelog](https://github.com/UndefinedOffset/SortableGridField/compare/2.0.1...2.0.2) diff --git a/src/Forms/GridFieldSortableRows.php b/src/Forms/GridFieldSortableRows.php index 270984e..bd80b69 100644 --- a/src/Forms/GridFieldSortableRows.php +++ b/src/Forms/GridFieldSortableRows.php @@ -234,11 +234,11 @@ class GridFieldSortableRows implements GridField_HTMLProvider, GridField_ActionP $sng = singleton($gridField->getModelClass()); $fieldType = $sng->config()->db[$this->sortColumn]; - if (!$fieldType || !(strtolower($fieldType) == 'int' || is_subclass_of($fieldType, 'Int'))) { + if (!$fieldType || !($fieldType == 'SilverStripe\\ORM\\FieldType\\DBInt' || is_subclass_of($fieldType, 'SilverStripe\\ORM\\FieldType\\DBInt'))) { if (is_array($fieldType)) { user_error('Sort column ' . $this->sortColumn . ' could not be found in ' . $gridField->getModelClass() . '\'s ancestry', E_USER_ERROR); } else { - user_error('Sort column ' . $this->sortColumn . ' must be an Int, column is of type ' . $fieldType, E_USER_ERROR); + user_error('Sort column ' . $this->sortColumn . ' must be an instance of SilverStripe\\ORM\\FieldType\\DBInt, column is of type ' . $fieldType, E_USER_ERROR); } exit;