Fixed potential issue with DBInt

This commit is contained in:
UndefinedOffset 2018-03-01 10:45:44 -04:00
parent e53e3622a4
commit 20da27f7dd
2 changed files with 5 additions and 2 deletions

View File

@ -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)

View File

@ -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;