public function MigrateDestinationVotingapi::bulkRollback in Migrate Extras 6.2
Same name and namespace in other branches
- 7.2 votingapi.inc \MigrateDestinationVotingapi::bulkRollback()
Delete the provided votes and recalculate the results.
Parameters
$id: IDs to be deleted.
File
- ./
votingapi.inc, line 37 - VotingAPI module integration
Class
- MigrateDestinationVotingapi
- Destination class for the votingapi_vote table.
Code
public function bulkRollback(array $ids) {
migrate_instrument_start(__METHOD__);
$votes = db_select('votingapi_vote', 'vv')
->fields('vv', array(
'content_id',
'content_type',
))
->condition('vote_id', $ids, 'IN')
->execute();
db_delete('votingapi_vote')
->condition('vote_id', $ids, 'IN') > execute();
// foreach($votes as $vote) {
// votingapi_recalculate_results($vote['content_type'], $vote['content_id'], TRUE);
// }
migrate_instrument_stop(__METHOD__);
}