Commit 9df3fff5 authored by totten's avatar totten

(#217) Campaign Selector - Change direct SQL call to `prevnext->fillWithSql(...)`

parent 83068a64
......@@ -281,18 +281,19 @@ class CRM_Campaign_Selector_Search extends CRM_Core_Selector_Base implements CRM
list($select, $from) = explode(' FROM ', $sql);
$insertSQL = "
INSERT INTO civicrm_prevnext_cache ( entity_table, entity_id1, entity_id2, cacheKey, data )
SELECT 'civicrm_contact',,, '$cacheKey', contact_a.display_name
$selectSQL = "
SELECT 'civicrm_contact',,, '$cacheKey', contact_a.display_name
FROM {$from}
$errorScope = CRM_Core_TemporaryErrorScope::ignoreException();
$result = CRM_Core_DAO::executeQuery($insertSQL);
if (is_a($result, 'DB_Error')) {
try {
Civi::service('prevnext')->fillWithSql($cacheKey, $selectSQL);
catch (CRM_Core_Exception $e) {
// Heavy handed, no? Seems like this merits an explanation.
// also record an entry in the cache key table, so we can delete it periodically
CRM_Core_BAO_Cache::setItem($cacheKey, 'CiviCRM Search PrevNextCache', $cacheKey);
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment