You are here

protected function DrupalNodeMigration::createStub in Drupal-to-Drupal data migration 7.2

Implementation of Migration::createStub().

Parameters

$migration:

Return value

array|bool

2 calls to DrupalNodeMigration::createStub()
DrupalNode6Migration::prepareRow in d6/node.inc
Called after the query data is fetched - we'll use this to populate the source row with the CCK fields.
DrupalNode7Migration::prepareRow in d7/node.inc
Called after the query data is fetched - we'll use this to populate the source row with the CCK fields.

File

./node.inc, line 193
Base class for migrating nodes into Drupal.

Class

DrupalNodeMigration
Base class for all node migrations - handles commonalities across all supported source Drupal versions.

Code

protected function createStub($migration) {
  migrate_instrument_start('DrupalNodeMigration::createStub');
  $node = new stdClass();
  $node->title = t('Stub');
  $node->body = array(
    LANGUAGE_NONE => array(
      array(
        "value" => t('Stub body'),
      ),
    ),
  );
  $node->type = $this->destination
    ->getBundle();
  $node->uid = 1;
  node_save($node);
  migrate_instrument_stop('DrupalNodeMigration::createStub');
  if (isset($node->nid)) {
    return array(
      $node->nid,
    );
  }
  else {
    return FALSE;
  }
}