forked from civicrm/civicrm-core
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(dev/core#217) Query::getCachedContacts - Use swappable fetch() inste…
…ad of SQL JOIN The general context of this code is roughly as follows: * We've already filled up the prevnext cache with a bunch of contact-IDs. * The user wants to view a page of 50 contacts. * We want to lookup full information about 50 specific contacts for this page. It does makes sense to use `CRM_Contact_BAO_Query` for looking up the "full information" about contacts. However, the function `Query::getCachedContacts()` is hard-coded to read from the SQL-based prevnext cache. Before ------ * In `getCachedContacts()`, it grabbed the full SQL for `CRM_Contact_BAO_Query` and munged the query to: * Add an extra JOIN on `civicrm_prevnext_cache` (with a constraint on `cacheKey`) * Respect pagination (LIMIT/OFFSET) * Order results based on their position in the prevnext cache After ----- * In `CRM_Core_PrevNextCache_Interface`, the `fetch()` function provides one page-worth of contact IDs (in order). The `fetch()` function is tested by `E2E_Core_PrevNextTest`. * In `getCachedContacts()`, it doesn't know anything about `civicrm_prevnext_cache` or `cacheKey` or pagination. Instead, it just accepts CIDs for one page-worth of contacts. It returns contacts in the same order that was given.
- Loading branch information
Showing
5 changed files
with
80 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters