abstract class MigrateMap in Migrate 6.2
Same name and namespace in other branches
- 7.2 includes/map.inc \MigrateMap
We implement the Iterator interface to support iteration over the map table for the purpose of rollback.
Hierarchy
- class \MigrateMap implements \Iterator
Expanded class hierarchy of MigrateMap
File
- includes/
map.inc, line 12 - Defines the framework for map and message handling.
View source
abstract class MigrateMap implements Iterator {
/**
* Codes reflecting the current status of a map row.
*/
const STATUS_IMPORTED = 0;
const STATUS_NEEDS_UPDATE = 1;
const STATUS_IGNORED = 2;
const STATUS_FAILED = 3;
/**
* Codes reflecting how to handle the destination item on rollback.
*
*/
const ROLLBACK_DELETE = 0;
const ROLLBACK_PRESERVE = 1;
/**
* Arrays of key fields for the source and destination. Array keys are the
* field names - array values are specific to the concrete map class.
*
* @var array
*/
protected $sourceKey, $destinationKey;
public abstract function getSourceKey();
public abstract function getDestinationKey();
/**
* Mapping from field names to the map/message table key names (e.g.,
* from input_field to sourceid1, or from nid to destid1)
*
* @var array
*/
protected $sourceKeyMap, $destinationKeyMap;
/**
* Boolean determining whether to track last_imported times in map tables
*
* @var boolean
*/
protected $trackLastImported = FALSE;
/**
* Save a mapping from the key values in the source row to the destination
* keys.
*
* @param $source_row
* @param $dest_ids
* @param $status
* @param $rollback_action
*/
public abstract function saveIDMapping(stdClass $source_row, array $dest_ids, $status = MigrateMap::STATUS_IMPORTED, $rollback_action = MigrateMap::ROLLBACK_DELETE);
/**
* Record a message related to a source record
*
* @param array $source_key
* Source ID of the record in error
* @param string $message
* The message to record.
* @param int $level
* Optional message severity (defaults to MESSAGE_ERROR).
*/
public abstract function saveMessage($source_key, $message, $level = MigrationBase::MESSAGE_ERROR);
/**
* Prepare to run a full update - mark all previously-imported content as
* ready to be re-imported.
*/
public abstract function prepareUpdate();
/**
* Report the number of processed items in the map
*/
public abstract function processedCount();
/**
* Report the number of imported items in the map
*/
public abstract function importedCount();
/**
* Report the number of items that failed to import
*/
public abstract function errorCount();
/**
* Report the number of messages
*/
public abstract function messageCount();
/**
* Delete the map and message entries for a given source record
*
* @param array $source_key
*/
public abstract function delete(array $source_key, $messages_only = FALSE);
/**
* Delete the map and message entries for a given destination record
*
* @param array $destination_key
*/
public abstract function deleteDestination(array $destination_key);
/**
* Delete the map and message entries for a set of given source records.
*
* @param array $source_keys
*/
public abstract function deleteBulk(array $source_keys);
/**
* Clear all messages from the map.
*/
public abstract function clearMessages();
/**
* Retrieve map data for a given source or destination item
*/
public abstract function getRowBySource(array $source_id);
public abstract function getRowByDestination(array $destination_id);
/**
* Retrieve an array of map rows marked as needing update.
*/
public abstract function getRowsNeedingUpdate($count);
/**
* Given a (possibly multi-field) destination key, return the (possibly multi-field)
* source key mapped to it.
*
* @param array $destination_id
* Array of destination key values.
* @return array
* Array of source key values, or NULL on failure.
*/
public abstract function lookupSourceID(array $destination_id);
/**
* Given a (possibly multi-field) source key, return the (possibly multi-field)
* destination key it is mapped to.
*
* @param array $source_id
* Array of source key values.
* @return array
* Array of destination key values, or NULL on failure.
*/
public abstract function lookupDestinationID(array $source_id);
/**
* Remove any persistent storage used by this map (e.g., map and message tables)
*/
public abstract function destroy();
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MigrateMap:: |
protected | property | Arrays of key fields for the source and destination. Array keys are the field names - array values are specific to the concrete map class. | |
MigrateMap:: |
protected | property | Mapping from field names to the map/message table key names (e.g., from input_field to sourceid1, or from nid to destid1) | |
MigrateMap:: |
protected | property | Boolean determining whether to track last_imported times in map tables | |
MigrateMap:: |
abstract public | function | Clear all messages from the map. | 1 |
MigrateMap:: |
abstract public | function | Delete the map and message entries for a given source record | 1 |
MigrateMap:: |
abstract public | function | Delete the map and message entries for a set of given source records. | 1 |
MigrateMap:: |
abstract public | function | Delete the map and message entries for a given destination record | 1 |
MigrateMap:: |
abstract public | function | Remove any persistent storage used by this map (e.g., map and message tables) | 1 |
MigrateMap:: |
abstract public | function | Report the number of items that failed to import | 1 |
MigrateMap:: |
abstract public | function | 1 | |
MigrateMap:: |
abstract public | function | 1 | |
MigrateMap:: |
abstract public | function | Retrieve map data for a given source or destination item | 1 |
MigrateMap:: |
abstract public | function | Retrieve an array of map rows marked as needing update. | 1 |
MigrateMap:: |
abstract public | function | 1 | |
MigrateMap:: |
abstract public | function | Report the number of imported items in the map | 1 |
MigrateMap:: |
abstract public | function | Given a (possibly multi-field) source key, return the (possibly multi-field) destination key it is mapped to. | 1 |
MigrateMap:: |
abstract public | function | Given a (possibly multi-field) destination key, return the (possibly multi-field) source key mapped to it. | 1 |
MigrateMap:: |
abstract public | function | Report the number of messages | 1 |
MigrateMap:: |
abstract public | function | Prepare to run a full update - mark all previously-imported content as ready to be re-imported. | 1 |
MigrateMap:: |
abstract public | function | Report the number of processed items in the map | 1 |
MigrateMap:: |
constant | Codes reflecting how to handle the destination item on rollback. | ||
MigrateMap:: |
constant | |||
MigrateMap:: |
abstract public | function | Save a mapping from the key values in the source row to the destination keys. | 1 |
MigrateMap:: |
abstract public | function | Record a message related to a source record | 1 |
MigrateMap:: |
constant | |||
MigrateMap:: |
constant | |||
MigrateMap:: |
constant | Codes reflecting the current status of a map row. | ||
MigrateMap:: |
constant |