You are here

public function Migration::removeFieldMapping in Migrate 6.2

Same name and namespace in other branches
  1. 7.2 includes/migration.inc \Migration::removeFieldMapping()

Remove any existing mappings for a given destination or source field.

Parameters

string $destination_field: Name of the destination field.

string $source_field: Name of the source field.

File

includes/migration.inc, line 215
Defines the base class for import/rollback processes.

Class

Migration
The base class for all import objects. This is where most of the smarts of the migrate module resides. Migrations are created by deriving from this class, and in the constructor (after calling parent::__construct()) initializing at a minimum the name,…

Code

public function removeFieldMapping($destination_field, $source_field = NULL) {
  if (isset($destination_field)) {
    unset($this->fieldMappings[$destination_field]);
  }
  if (isset($source_field)) {
    foreach ($this->fieldMappings as $key => $mapping) {
      if ($mapping
        ->getSourceField() == $source_field) {
        unset($this->fieldMappings[$key]);
      }
    }
  }
}