You are here

function _votingapi_delete_cache_by_entity in Voting API 7.2

Helper function to delete all cache entries on given entities.

Parameters

array entity ids:

string entity type:

2 calls to _votingapi_delete_cache_by_entity()
votingapi_entity_delete in ./votingapi.module
Implements hook_entity_delete().
_votingapi_cron_delete_orphaned in ./votingapi.module
Delete votes and cache entries for a number of entities in the queue.

File

./votingapi.module, line 702
A generalized voting API for Drupal.

Code

function _votingapi_delete_cache_by_entity($entity_ids, $type) {
  $result = db_select('votingapi_cache', 'v')
    ->fields('v', array(
    'vote_cache_id',
  ))
    ->condition('entity_type', $type)
    ->condition('entity_id', $entity_ids)
    ->execute();
  $votes = array();
  foreach ($result as $row) {
    $votes[]['vote_cache_id'] = $row->vote_cache_id;
  }
  votingapi_delete_results($votes);
}