You are here

protected function FeedsRulesProcessor::revertComponent in Feeds Rules 7

Callback to revert a single rules component call represented by the feeds rules action entity.

Parameters

integer $entity_id:

1 call to FeedsRulesProcessor::revertComponent()
FeedsRulesProcessor::entityDeleteMultiple in plugins/FeedsRulesProcessor.inc
Deletes the log entities. Also initiates the revert component method, if it is configured.

File

plugins/FeedsRulesProcessor.inc, line 102
Defines the Feeds Rules processor plugin.

Class

FeedsRulesProcessor
Feeds processor plugin to process a rules component for each feed items.

Code

protected function revertComponent($entity_id) {
  $reverse_action = rules_get_cache('comp_' . $this->config['reverse-component']['component']);
  if ($reverse_action) {
    $entity = entity_load_single('feeds_rules_action', $entity_id);
    $args = array();

    // Build the argument array if mapping is set.
    if (!empty($this->config['reverse-component']['mapping'])) {
      foreach ($this->config['reverse-component']['mapping'] as $target => $source) {
        list($type, $source_key) = explode('::', $source, 2);
        $args[$target] = isset($entity->{$type}[$source_key]) ? $entity->{$type}[$source_key] : '';
      }
    }
    $reverse_action
      ->executeByArgs($args);
  }
}