public function MigrateDestinationEntity::prepare in Migrate 6.2
Same name and namespace in other branches
- 7.2 plugins/destinations/entity.inc \MigrateDestinationEntity::prepare()
Give handlers a shot at modifying the object before saving it.
Parameters
$entity: Entity object to build. Prefilled with any fields mapped in the Migration.
$source_row: Raw source data object - passed through to prepare handlers.
4 calls to MigrateDestinationEntity::prepare()
- 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 126 
- 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 prepare($entity, stdClass $source_row) {
  // Add source keys for debugging and identification of migrated data by hooks.
  /* TODO: Restore
     foreach ($migration->sourceKeyMap() as $field_name => $key_name) {
       $keys[$key_name] = $source_row->$field_name;
     }
     */
  $migration = Migration::currentMigration();
  $entity->migrate = array(
    //      'source_keys' => $keys,
    'machineName' => $migration
      ->getMachineName(),
  );
  // Call any general entity handlers (in particular, the builtin field handler)
  migrate_handler_invoke_all('Entity', 'prepare', $entity, $source_row);
  // Then call any entity-specific handlers
  migrate_handler_invoke_all($this->entityType, 'prepare', $entity, $source_row);
  // Then call any prepare handler for this specific Migration.
  if (method_exists($migration, 'prepare')) {
    $migration
      ->prepare($entity, $source_row);
  }
}