You are here

public function FeedsMapperFieldTestCase::mappingExists in Entity reference 7

Check if mapping exists.

Parameters

string $id: ID of the importer.

integer $i: The key of the mapping.

string $source: The source field.

string $target: The target field.

Return value

integer -1 if the mapping doesn't exist, the key of the mapping otherwise.

1 call to FeedsMapperFieldTestCase::mappingExists()
FeedsMapperFieldTestCase::addMappings in tests/entityreference.feeds.test
Adds mappings to a given configuration.

File

tests/entityreference.feeds.test, line 61
Test case for simple CCK field mapper mappers/content.inc.

Class

FeedsMapperFieldTestCase
Class for testing Feeds field mapper.

Code

public function mappingExists($id, $i, $source, $target) {
  $current_mappings = $this
    ->getCurrentMappings($id);
  if ($current_mappings) {
    foreach ($current_mappings as $key => $mapping) {
      if ($mapping['source'] == $source && $mapping['target'] == $target && $key == $i) {
        return $key;
      }
    }
  }
  return -1;
}