public function ExampleImageMigration::prepareRow in Drupal-to-Drupal data migration 7.2
Implementation of Migration::prepareRow().
Here we pull in additional data from a non-core, non-CCK table.
Parameters
$row:
Overrides DrupalNode6Migration::prepareRow
File
- migrate_d2d_example/
node.inc, line 40
Class
- ExampleImageMigration
- Image-specific mappings and handling.
Code
public function prepareRow($row) {
if (parent::prepareRow($row) === FALSE) {
return FALSE;
}
$image_row = Database::getConnection('default', $this->sourceConnection)
->select('custom_image_table', 'i')
->fields('i', array(
'copyright',
'filename',
))
->condition('vid', $row->vid)
->execute()
->fetchObject();
if ($image_row) {
$row->copyright = $image_row->copyright;
$row->filename = $image_row->filename;
}
else {
$this
->saveMessage(t('No custom_image_table data for image node with vid !vid', array(
'!vid' => $row->vid,
)));
}
}