diff --git a/CRM/Contact/Selector.php b/CRM/Contact/Selector.php index 0561812fa8e..c54c02bd594 100644 --- a/CRM/Contact/Selector.php +++ b/CRM/Contact/Selector.php @@ -902,7 +902,7 @@ public function buildPrevNextCache($sort) { $sortByCharacter = CRM_Utils_Request::retrieve('sortByCharacter', 'String'); //for text field pagination selection save - $countRow = CRM_Core_BAO_PrevNextCache::getCount($cacheKey, NULL, "entity_table = 'civicrm_contact'"); + $countRow = Civi::service('prevnext')->getCount($cacheKey); // $sortByCharacter triggers a refresh in the prevNext cache if ($sortByCharacter && $sortByCharacter != 'all') { $cacheKey .= "_alphabet"; diff --git a/CRM/Core/PrevNextCache/Interface.php b/CRM/Core/PrevNextCache/Interface.php index 55b4058c585..60c68c8aeb5 100644 --- a/CRM/Core/PrevNextCache/Interface.php +++ b/CRM/Core/PrevNextCache/Interface.php @@ -121,4 +121,12 @@ public function getPositions($cacheKey, $id1, $id2); */ public function deleteItem($id = NULL, $cacheKey = NULL, $entityTable = 'civicrm_contact'); + /** + * Get count of matching rows. + * + * @param string $cacheKey + * @return int + */ + public function getCount($cacheKey); + } diff --git a/CRM/Core/PrevNextCache/Sql.php b/CRM/Core/PrevNextCache/Sql.php index 2eaf698f487..2d414c6f659 100644 --- a/CRM/Core/PrevNextCache/Sql.php +++ b/CRM/Core/PrevNextCache/Sql.php @@ -231,4 +231,14 @@ public function deleteItem($id = NULL, $cacheKey = NULL, $entityTable = 'civicrm CRM_Core_BAO_PrevNextCache::deleteItem($id, $cacheKey, $entityTable); } + /** + * Get count of matching rows. + * + * @param string $cacheKey + * @return int + */ + public function getCount($cacheKey) { + return CRM_Core_BAO_PrevNextCache::getCount($cacheKey, NULL, "entity_table = 'civicrm_contact'"); + } + }