You are here

function migrate_example_wine_data_files in Migrate 7.2

Same name and namespace in other branches
  1. 6.2 migrate_example/wine.install.inc \migrate_example_wine_data_files()
3 calls to migrate_example_wine_data_files()
migrate_example_update_7003 in migrate_example/migrate_example.install
Add data for remote file examples.
migrate_example_update_7005 in migrate_example/migrate_example.install
Expand file field example data.
migrate_example_wine_install in migrate_example/wine.install.inc

File

migrate_example/wine.install.inc, line 1361
Set up for the wine (advanced) example.

Code

function migrate_example_wine_data_files() {
  $fields = array(
    'imageid',
    'url',
    'image_alt',
    'image_title',
    'wineid',
  );
  $query = db_insert('migrate_example_wine_files')
    ->fields($fields);
  $data = array(
    array(
      1,
      'http://placekitten.com/200/200',
      NULL,
      NULL,
      NULL,
    ),
    array(
      2,
      'http://cyrve.com/files/penguin.jpeg',
      'Penguin alt',
      'Penguin title',
      1,
    ),
    array(
      3,
      'http://cyrve.com/files/rioja.jpeg',
      'Rioja alt',
      'Rioja title',
      2,
    ),
    array(
      4,
      'http://cyrve.com/files/boutisse_0.jpeg',
      'Boutisse alt',
      'Boutisse title',
      2,
    ),
  );
  foreach ($data as $row) {
    $query
      ->values(array_combine($fields, $row));
  }
  $query
    ->execute();
}