From f7fbf5b0e032176de963c899273612b6564e3607 Mon Sep 17 00:00:00 2001 From: Grant Heggie Date: Fri, 8 Sep 2017 11:29:18 +1000 Subject: [PATCH] fix(ListFilterForm): use getTotalItems() instead of TotalItems() - for 3.1 compatibility fix(ListFilterUtility): use many_many() if manyManyComponent() method doesn't exist - for 3.1 compatibility --- code/ListFilterUtility.php | 5 +++-- code/form/ListFilterForm.php | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/code/ListFilterUtility.php b/code/ListFilterUtility.php index 43967e8..0c1b8a0 100644 --- a/code/ListFilterUtility.php +++ b/code/ListFilterUtility.php @@ -93,8 +93,9 @@ public static function filter_by_relation_ids(SS_List $list, $relationName, arra $list = new ArrayList($result); } else { $idsSQL = "(".implode(',', $ids).")"; - - list($parentClass, $componentClass, $myIDColumnName, $relationIDColumnName, $manyManyTable) = singleton($class)->manyManyComponent($relationName); + $classObj = singleton($class); + $manyManyInfo = $classObj->hasMethod('manyManyComponent') ? 'manyManyComponent' : 'many_many'; + list($parentClass, $componentClass, $myIDColumnName, $relationIDColumnName, $manyManyTable) = $classObj->$manyManyInfo($relationName); $list = $list->innerJoin($manyManyTable, "\"{$myIDColumnName}\" = \"$parentClass\".\"ID\" AND \"{$relationIDColumnName}\" IN {$idsSQL}"); } break; diff --git a/code/form/ListFilterForm.php b/code/form/ListFilterForm.php index 615ac54..aad2d42 100644 --- a/code/form/ListFilterForm.php +++ b/code/form/ListFilterForm.php @@ -393,7 +393,7 @@ public function ShowingMessage(SS_List $list = null) { } } - $data['TotalCount'] = $list->TotalItems(); + $data['TotalCount'] = $list->getTotalItems(); if ($start < $data['TotalCount']) { $data['OffsetStart'] = $start + 1; $data['ThisPage'] = $list->CurrentPage();