You are here

public function MigrateDestinationEntity::complete in Migrate 6.2

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

Give handlers a shot at modifying the object (or taking additional action) after saving it.

Parameters

$object: Entity object to build. This is the complete object after saving.

$source_row: Raw source data object - passed through to complete handlers.

4 calls to MigrateDestinationEntity::complete()
MigrateDestinationComment::import in plugins/destinations/comment.inc
Import a single comment.
MigrateDestinationNode::import in plugins/destinations/node.inc
Import a single node.
MigrateDestinationTerm::import in plugins/destinations/term.inc
Import a single term.
MigrateDestinationUser::import in plugins/destinations/user.inc
Import a single user.

File

plugins/destinations/entity.inc, line 158
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 complete($entity, stdClass $source_row) {

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

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

  // Then call any complete handler for this specific Migration.
  $migration = Migration::currentMigration();
  if (method_exists($migration, 'complete')) {
    try {
      $migration
        ->complete($entity, $source_row);
    } catch (Exception $e) {

      // If we catch any errors here, save the messages without letting
      // the exception prevent the saving of the entity being recorded.
      $migration
        ->saveMessage($e
        ->getMessage());
    }
  }
}