You are here

public function MigrateDestinationEntity::prepareRollback in Migrate 6.2

Same name and namespace in other branches
  1. 7.2 plugins/destinations/entity.inc \MigrateDestinationEntity::prepareRollback()

Give handlers a shot at cleaning up before an entity has been rolled back.

Parameters

$entity_id: ID of the entity about to be deleted..

4 calls to MigrateDestinationEntity::prepareRollback()
MigrateDestinationComment::rollback in plugins/destinations/comment.inc
Delete a comment
MigrateDestinationNode::rollback in plugins/destinations/node.inc
Delete a node
MigrateDestinationTerm::rollback in plugins/destinations/term.inc
Delete a migrated term
MigrateDestinationUser::bulkRollback in plugins/destinations/user.inc
Delete a batch of users at once.

File

plugins/destinations/entity.inc, line 87
Defines base for migration destinations implemented as Drupal entities. Drupal 6 note: Yes, there is no "entity" in D6. We maintain this intermediate class to simplify keeping the D6 and D7 implementations in sync.

Class

MigrateDestinationEntity
Abstract base class for entity-based destination handling. Holds common Field API-related functions.

Code

public function prepareRollback($entity_id) {
  $migration = Migration::currentMigration();

  // Call any general entity handlers (in particular, the builtin field handler)
  migrate_handler_invoke_all('Entity', 'prepareRollback', $entity_id);

  // Then call any entity-specific handlers
  migrate_handler_invoke_all($this->entityType, 'prepareRollback', $entity_id);

  // Then call any prepare handler for this specific Migration.
  if (method_exists($migration, 'prepareRollback')) {
    $migration
      ->prepareRollback($entity_id);
  }
}