Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / modules / contrib / migrate_plus / migrate_example_advanced / migrate_example_advanced_setup / migrate_example_advanced_setup.install
index 3c585b19ceae1b3b255ae01c6980a9ce0d051504..be9031a6beef0910247f48012ad986417eb5f860 100644 (file)
@@ -1,8 +1,9 @@
 <?php
-use Drupal\user\RoleInterface;
 
 /**
  * @file
+ * Install setup for the migration example module.
+ *
  * Set up source data and destination configuration for the migration example
  * module. We do this in a separate module so migrate_example_advanced itself is
  * a pure migration module.
@@ -54,6 +55,12 @@ function migrate_example_advanced_setup_install() {
   migrate_example_advanced_data_table_source();
 }
 
+/**
+ * The hook_schema definition for wine.
+ *
+ * @return array
+ *   The schema definition.
+ */
 function migrate_example_advanced_schema_wine() {
   return [
     'description' => 'Wines of the world',
@@ -122,8 +129,14 @@ function migrate_example_advanced_schema_wine() {
   ];
 }
 
+/**
+ * The hook_schema definition for updates.
+ *
+ * @return array
+ *   The schema definition.
+ */
 function migrate_example_advanced_schema_updates() {
-  return array(
+  return [
     'description' => 'Updated wine ratings',
     'fields' => [
       'wineid'  => [
@@ -140,754 +153,1068 @@ function migrate_example_advanced_schema_updates() {
       ],
     ],
     'primary key' => ['wineid'],
-  );
+  ];
 }
 
+/**
+ * The hook_schema definition for producer.
+ *
+ * @return array
+ *   The schema definition.
+ */
 function migrate_example_advanced_schema_producer() {
-  return array(
+  return [
     'description' => 'Wine producers of the world',
-    'fields' => array(
-      'producerid'  => array(
+    'fields' => [
+      'producerid'  => [
         'type' => 'int',
         'unsigned' => TRUE,
         'not null' => TRUE,
         'description' => 'Producer ID',
-      ),
-      'name'  => array(
+      ],
+      'name'  => [
         'type' => 'varchar',
         'length' => 255,
         'not null' => TRUE,
-      ),
-      'body' => array(
+      ],
+      'body' => [
         'type' => 'varchar',
         'length' => 255,
         'not null' => FALSE,
         'description' => 'Full description of the producer.',
-      ),
-      'excerpt' => array(
+      ],
+      'excerpt' => [
         'type' => 'varchar',
         'length' => 255,
         'not null' => FALSE,
         'description' => 'Abstract for this producer.',
-      ),
-      'accountid' => array(
+      ],
+      'accountid' => [
         'type' => 'int',
         'unsigned' => TRUE,
         'not null' => FALSE,
         'description' => 'Account ID of the author.',
-      ),
-    ),
-    'primary key' => array('producerid'),
-  );
+      ],
+    ],
+    'primary key' => ['producerid'],
+  ];
 }
 
+/**
+ * The hook_schema definition for categories.
+ *
+ * @return array
+ *   The schema definition.
+ */
 function migrate_example_advanced_schema_categories() {
-  return array(
+  return [
     'description' => 'Categories',
-    'fields' => array(
-      'categoryid' => array(
+    'fields' => [
+      'categoryid' => [
         'type' => 'int',
         'not null' => TRUE,
         'unsigned' => TRUE,
         'description' => 'Category ID',
-      ),
-      'type' => array(
+      ],
+      'type' => [
         'type' => 'varchar',
         'length' => 255,
         'not null' => TRUE,
         'description' => 'Type of category: variety, region, best_with',
-      ),
-      'name'  => array(
+      ],
+      'name'  => [
         'type' => 'varchar',
         'length' => 255,
         'not null' => TRUE,
-      ),
-      'details' => array(
+      ],
+      'details' => [
         'type' => 'varchar',
         'length' => 255,
         'not null' => FALSE,
-      ),
-      'category_parent' => array(
+      ],
+      'category_parent' => [
         'type' => 'int',
         'unsigned' => TRUE,
         'not null' => FALSE,
         'description' => 'Parent category, if any',
-      ),
-      'ordering' => array(
+      ],
+      'ordering' => [
         'type' => 'int',
         'unsigned' => FALSE,
         'not null' => FALSE,
         'description' => 'Order in which to display categories',
-      ),
-    ),
-    'primary key' => array('categoryid'),
-  );
+      ],
+    ],
+    'primary key' => ['categoryid'],
+  ];
 }
 
+/**
+ * The hook_schema definition for vintages.
+ *
+ * @return array
+ *   The schema definition.
+ */
 function migrate_example_advanced_schema_vintages() {
-  return array(
+  return [
     'description' => 'Wine vintages',
-    'fields' => array(
-      'wineid'  => array(
+    'fields' => [
+      'wineid'  => [
         'type' => 'int',
         'not null' => TRUE,
         'description' => 'Wine ID',
-      ),
-      'vintage'  => array(
+      ],
+      'vintage'  => [
         'type' => 'int',
         'unsigned' => TRUE,
         'not null' => TRUE,
         'description' => 'Vintage (year)',
-      ),
-    ),
-    'primary key' => array('wineid', 'vintage'),
-  );
+      ],
+    ],
+    'primary key' => ['wineid', 'vintage'],
+  ];
 }
 
+/**
+ * The hook_schema definition for variety updates.
+ *
+ * @return array
+ *   The schema definition.
+ */
 function migrate_example_advanced_schema_variety_updates() {
-  return array(
+  return [
     'description' => 'Variety updates',
-    'fields' => array(
-      'categoryid' => array(
+    'fields' => [
+      'categoryid' => [
         'type' => 'int',
         'not null' => TRUE,
         'unsigned' => TRUE,
         'description' => 'Category ID',
-      ),
-      'details' => array(
+      ],
+      'details' => [
         'type' => 'varchar',
         'length' => 255,
         'not null' => FALSE,
-      ),
-    ),
-    'primary key' => array('categoryid'),
-  );
+      ],
+    ],
+    'primary key' => ['categoryid'],
+  ];
 }
 
+/**
+ * The hook_schema definition for category wine.
+ *
+ * @return array
+ *   The schema definition.
+ */
 function migrate_example_advanced_schema_category_wine() {
-  return array(
+  return [
     'description' => 'Wine category assignments',
-    'fields' => array(
-      'wineid'  => array(
+    'fields' => [
+      'wineid'  => [
         'type' => 'int',
         'not null' => TRUE,
         'description' => 'Wine ID',
-      ),
-      'categoryid'  => array(
+      ],
+      'categoryid'  => [
         'type' => 'int',
         'unsigned' => TRUE,
         'not null' => TRUE,
         'description' => 'Category ID',
-      ),
-    ),
-    'primary key' => array('categoryid', 'wineid'),
-  );
+      ],
+    ],
+    'primary key' => ['categoryid', 'wineid'],
+  ];
 }
 
+/**
+ * The hook_schema definition for category producer.
+ *
+ * @return array
+ *   The schema definition.
+ */
 function migrate_example_advanced_schema_category_producer() {
-  return array(
+  return [
     'description' => 'Producer category assignments',
-    'fields' => array(
-      'producerid'  => array(
+    'fields' => [
+      'producerid'  => [
         'type' => 'int',
         'not null' => TRUE,
         'description' => 'Producer ID',
-      ),
-      'categoryid'  => array(
+      ],
+      'categoryid'  => [
         'type' => 'int',
         'unsigned' => TRUE,
         'not null' => TRUE,
         'description' => 'Category ID',
-      ),
-    ),
-    'primary key' => array('categoryid', 'producerid'),
-  );
+      ],
+    ],
+    'primary key' => ['categoryid', 'producerid'],
+  ];
 }
 
+/**
+ * The hook_schema definition for comment.
+ *
+ * @return array
+ *   The schema definition.
+ */
 function migrate_example_advanced_schema_comment() {
-  return array(
+  return [
     'description' => 'Wine comments',
-    'fields' => array(
-      'commentid'  => array(
+    'fields' => [
+      'commentid'  => [
         'type' => 'int',
         'unsigned' => TRUE,
         'not null' => TRUE,
         'description' => 'Comment ID',
-      ),
-      'wineid'  => array(
+      ],
+      'wineid'  => [
         'type' => 'int',
         'unsigned' => TRUE,
         'not null' => TRUE,
         'description' => 'Wine ID that is being commented upon',
-      ),
-      'comment_parent' => array(
+      ],
+      'comment_parent' => [
         'type' => 'int',
         'unsigned' => TRUE,
         'not null' => FALSE,
         'description' => 'Parent comment ID in case of comment replies.',
-      ),
-      'subject' => array(
+      ],
+      'subject' => [
         'type' => 'varchar',
         'length' => 255,
         'not null' => FALSE,
         'description' => 'Comment subject',
-      ),
-      'body' => array(
+      ],
+      'body' => [
         'type' => 'varchar',
         'length' => 255,
         'not null' => FALSE,
         'description' => 'Comment body',
-      ),
-      'name' => array(
+      ],
+      'name' => [
         'type' => 'varchar',
         'length' => 255,
         'not null' => FALSE,
         'description' => 'Comment name (if anon)',
-      ),
-      'mail' => array(
+      ],
+      'mail' => [
         'type' => 'varchar',
         'length' => 255,
         'not null' => FALSE,
         'description' => 'Comment email (if anon)',
-      ),
-      'accountid' => array(
+      ],
+      'accountid' => [
         'type' => 'int',
         'unsigned' => TRUE,
         'not null' => FALSE,
         'description' => 'Account ID (if any).',
-      ),
-      'commenthost' => array(
+      ],
+      'commenthost' => [
         'type' => 'varchar',
         'length' => 255,
         'not null' => FALSE,
         'description' => 'IP/domain of host posted from',
-      ),
-      'userpage' => array(
+      ],
+      'userpage' => [
         'type' => 'varchar',
         'length' => 255,
         'not null' => FALSE,
         'description' => 'User homepage',
-      ),
-      'posted' => array(
+      ],
+      'posted' => [
         'type' => 'int',
         'unsigned' => TRUE,
         'not null' => TRUE,
         'description' => 'Date comment posted',
-      ),
-      'lastchanged' => array(
+      ],
+      'lastchanged' => [
         'type' => 'int',
         'unsigned' => TRUE,
         'not null' => TRUE,
         'description' => 'Date comment last changed',
-      ),
-    ),
-    'primary key' => array('commentid'),
-  );
+      ],
+    ],
+    'primary key' => ['commentid'],
+  ];
 }
 
+/**
+ * The hook_schema definition for comment updates.
+ *
+ * @return array
+ *   The schema definition.
+ */
 function migrate_example_advanced_schema_comment_updates() {
-  return array(
+  return [
     'description' => 'Wine comment updates',
-    'fields' => array(
-      'commentid'  => array(
+    'fields' => [
+      'commentid'  => [
         'type' => 'int',
         'unsigned' => TRUE,
         'not null' => TRUE,
         'description' => 'Comment ID',
-      ),
-      'subject' => array(
+      ],
+      'subject' => [
         'type' => 'varchar',
         'length' => 255,
         'not null' => FALSE,
         'description' => 'Comment subject',
-      ),
-    ),
-    'primary key' => array('commentid'),
-  );
+      ],
+    ],
+    'primary key' => ['commentid'],
+  ];
 }
 
+/**
+ * The hook_schema definition for account.
+ *
+ * @return array
+ *   The schema definition.
+ */
 function migrate_example_advanced_schema_account() {
-  return array(
+  return [
     'description' => 'Wine accounts.',
-    'fields' => array(
-      'accountid'  => array(
+    'fields' => [
+      'accountid'  => [
         'type' => 'serial',
         'not null' => TRUE,
         'description' => 'Account ID',
-      ),
-      'status'  => array(
+      ],
+      'status'  => [
         'type' => 'int',
         'not null' => TRUE,
         'description' => 'Blocked_Allowed',
-      ),
-      'posted' => array(
+      ],
+      'posted' => [
         'type' => 'varchar',
         'length' => 255,
         'not null' => TRUE,
         'description' => 'Registration date',
-      ),
-      'last_access' => array(
+      ],
+      'last_access' => [
         'type' => 'varchar',
         'length' => 255,
         'not null' => TRUE,
         'description' => 'Last access date',
-      ),
-      'last_login' => array(
+      ],
+      'last_login' => [
         'type' => 'varchar',
         'length' => 255,
         'not null' => TRUE,
         'description' => 'Last login date',
-      ),
-      'name' => array(
+      ],
+      'name' => [
         'type' => 'varchar',
         'length' => 255,
         'not null' => FALSE,
         'description' => 'Account name (for login)',
-      ),
-      'sex' => array(
+      ],
+      'sex' => [
         'type' => 'char',
         'length' => 1,
         'not null' => FALSE,
         'description' => 'Gender',
-      ),
-      'password' => array(
+      ],
+      'password' => [
         'type' => 'varchar',
         'length' => 255,
         'not null' => FALSE,
         'description' => 'Account password (raw)',
-      ),
-      'mail' => array(
+      ],
+      'mail' => [
         'type' => 'varchar',
         'length' => 255,
         'not null' => FALSE,
         'description' => 'Account email',
-      ),
-      'original_mail' => array(
+      ],
+      'original_mail' => [
         'type' => 'varchar',
         'length' => 255,
         'not null' => FALSE,
         'description' => 'Original account email',
-      ),
-      'sig' => array(
+      ],
+      'sig' => [
         'type' => 'varchar',
         'length' => 255,
         'not null' => TRUE,
         'description' => 'Signature for comments',
-      ),
-      'imageid'  => array(
+      ],
+      'imageid'  => [
         'type' => 'int',
         'unsigned' => TRUE,
         'not null' => FALSE,
         'description' => 'Image ID',
-      ),
-      'positions' => array(
+      ],
+      'positions' => [
         'type' => 'varchar',
         'length' => 255,
         'not null' => FALSE,
         'description' => 'Positions held',
-      ),
-    ),
-    'primary key' => array('accountid'),
-  );
+      ],
+    ],
+    'primary key' => ['accountid'],
+  ];
 }
 
+/**
+ * The hook_schema definition for account updates.
+ *
+ * @return array
+ *   The schema definition.
+ */
 function migrate_example_advanced_schema_account_updates() {
-  return array(
+  return [
     'description' => 'Wine account updates',
-    'fields' => array(
-      'accountid'  => array(
+    'fields' => [
+      'accountid'  => [
         'type' => 'serial',
         'not null' => TRUE,
         'description' => 'Account ID',
-      ),
-      'sex' => array(
+      ],
+      'sex' => [
         'type' => 'char',
         'length' => 1,
         'not null' => FALSE,
         'description' => 'Gender',
-      ),
-    ),
-    'primary key' => array('accountid'),
-  );
+      ],
+    ],
+    'primary key' => ['accountid'],
+  ];
 }
 
+/**
+ * The hook_schema definition for blobs.
+ *
+ * @return array
+ *   The schema definition.
+ */
 function migrate_example_advanced_schema_blobs() {
-  return array(
+  return [
     'description' => 'Wine blobs to be migrated to file entities',
-    'fields' => array(
-      'imageid'  => array(
+    'fields' => [
+      'imageid'  => [
         'type' => 'int',
         'unsigned' => TRUE,
         'not null' => TRUE,
         'description' => 'Image ID',
-      ),
-      'imageblob' => array(
+      ],
+      'imageblob' => [
         'type' => 'blob',
         'size' => 'normal',
         'description' => 'binary image data',
-      ),
-    ),
-    'primary key' => array('imageid'),
-  );
+      ],
+    ],
+    'primary key' => ['imageid'],
+  ];
 }
 
+/**
+ * The hook_schema definition for files.
+ *
+ * @return array
+ *   The schema definition.
+ */
 function migrate_example_advanced_schema_files() {
-  return array(
+  return [
     'description' => 'Wine and account files',
-    'fields' => array(
-      'imageid'  => array(
+    'fields' => [
+      'imageid'  => [
         'type' => 'int',
         'unsigned' => TRUE,
         'not null' => TRUE,
         'description' => 'Image ID',
-      ),
-      'url'  => array(
+      ],
+      'url'  => [
         'type' => 'varchar',
         'length' => 255,
         'not null' => TRUE,
         'description' => 'Image URL',
-      ),
-      'image_alt'  => array(
+      ],
+      'image_alt'  => [
         'type' => 'varchar',
         'length' => 255,
         'not null' => FALSE,
         'description' => 'Image alt',
-      ),
-      'image_title'  => array(
+      ],
+      'image_title'  => [
         'type' => 'varchar',
         'length' => 255,
         'not null' => FALSE,
         'description' => 'Image title',
-      ),
-      'wineid'  => array(
+      ],
+      'wineid'  => [
         'type' => 'int',
         'unsigned' => TRUE,
         'not null' => FALSE,
         'description' => 'Wine node this is associated with',
-      ),
-    ),
-    'primary key' => array('imageid'),
-  );
+      ],
+    ],
+    'primary key' => ['imageid'],
+  ];
 }
 
+/**
+ * The hook_schema definition for table source.
+ *
+ * @return array
+ *   The schema definition.
+ */
 function migrate_example_advanced_schema_table_source() {
-  return array(
+  return [
     'description' => 'Source data to go into a custom Drupal table',
-    'fields' => array(
-      'fooid'  => array(
+    'fields' => [
+      'fooid'  => [
         'type' => 'int',
         'unsigned' => TRUE,
         'not null' => TRUE,
         'description' => 'Primary key',
-      ),
-      'field1'  => array(
+      ],
+      'field1'  => [
         'type' => 'varchar',
         'length' => 255,
         'not null' => TRUE,
         'description' => 'First field',
-      ),
-      'field2'  => array(
+      ],
+      'field2'  => [
         'type' => 'int',
         'unsigned' => TRUE,
         'not null' => TRUE,
         'description' => 'Second field',
-      ),
-    ),
-    'primary key' => array('fooid'),
-  );
+      ],
+    ],
+    'primary key' => ['fooid'],
+  ];
 }
 
+/**
+ * The hook_schema definition for table destination.
+ *
+ * @return array
+ *   The schema definition.
+ */
 function migrate_example_advanced_schema_table_dest() {
-  return array(
+  return [
     'description' => 'Custom Drupal table to receive source data directly',
-    'fields' => array(
-      'recordid'  => array(
+    'fields' => [
+      'recordid'  => [
         'type' => 'serial',
         'unsigned' => TRUE,
         'not null' => TRUE,
         'description' => 'Primary key',
-      ),
-      'drupal_text'  => array(
+      ],
+      'drupal_text'  => [
         'type' => 'varchar',
         'length' => 255,
         'not null' => TRUE,
         'description' => 'First field',
-      ),
-      'drupal_int'  => array(
+      ],
+      'drupal_int'  => [
         'type' => 'int',
         'unsigned' => TRUE,
         'not null' => TRUE,
         'description' => 'Second field',
-      ),
-    ),
-    'primary key' => array('recordid'),
-  );
+      ],
+    ],
+    'primary key' => ['recordid'],
+  ];
 }
 
+/**
+ * Populate wine table.
+ */
 function migrate_example_advanced_data_wine() {
-  $fields = array('wineid', 'name', 'body', 'excerpt', 'accountid',
-    'posted', 'last_changed', 'variety', 'region', 'rating');
+  $fields = [
+    'wineid',
+    'name',
+    'body',
+    'excerpt',
+    'accountid',
+    'posted',
+    'last_changed',
+    'variety',
+    'region',
+    'rating',
+  ];
   $query = db_insert('migrate_example_wine')
-           ->fields($fields);
-  $data = array(
-    array(1, 'Montes Classic Cabernet Sauvignon', 'Intense ruby-red color', 'Great!', 9,
-      strtotime('2010-01-02 03:04:05'), strtotime('2010-03-04 05:06:07'), 25, 17, 95),
-    array(2, 'Archeo Ruggero di Tasso Nero d\'Avola', 'Lots of berry character', 'Pair with red sauced dishes', 3,
-      strtotime('2010-09-03 18:23:58'), strtotime('2010-09-03 18:23:58'), 26, 2, 85),
-  );
+    ->fields($fields);
+  $data = [
+    [
+      1,
+      'Montes Classic Cabernet Sauvignon',
+      'Intense ruby-red color',
+      'Great!',
+      9,
+      strtotime('2010-01-02 03:04:05'),
+      strtotime('2010-03-04 05:06:07'),
+      25,
+      17,
+      95,
+    ],
+    [
+      2,
+      'Archeo Ruggero di Tasso Nero d\'Avola',
+      'Lots of berry character',
+      'Pair with red sauced dishes',
+      3,
+      strtotime('2010-09-03 18:23:58'),
+      strtotime('2010-09-03 18:23:58'),
+      26,
+      2,
+      85,
+    ],
+  ];
   foreach ($data as $row) {
     $query->values(array_combine($fields, $row));
   }
   $query->execute();
 }
 
+/**
+ * Populate updates table.
+ */
 function migrate_example_advanced_data_updates() {
-  $fields = array('wineid', 'rating');
+  $fields = ['wineid', 'rating'];
   $query = db_insert('migrate_example_advanced_updates')
-           ->fields($fields);
-  $data = array(
-    array(1, 93),
-    array(2, NULL),
-  );
+    ->fields($fields);
+  $data = [
+    [1, 93],
+    [2, NULL],
+  ];
   foreach ($data as $row) {
     $query->values(array_combine($fields, $row));
   }
   $query->execute();
 }
 
+/**
+ * Populate producer table.
+ */
 function migrate_example_advanced_data_producer() {
-  $fields = array('producerid', 'name', 'body', 'excerpt', 'accountid');
+  $fields = ['producerid', 'name', 'body', 'excerpt', 'accountid'];
   $query = db_insert('migrate_example_advanced_producer')
-           ->fields($fields);
-  $data = array(
-    array(1, 'Montes', 'Fine Chilean winery', 'Great!', 9),
-    array(2, 'Archeo', 'Sicilia!', NULL, 3),
-  );
+    ->fields($fields);
+  $data = [
+    [1, 'Montes', 'Fine Chilean winery', 'Great!', 9],
+    [2, 'Archeo', 'Sicilia!', NULL, 3],
+  ];
   foreach ($data as $row) {
     $query->values(array_combine($fields, $row));
   }
   $query->execute();
 }
 
+/**
+ * Populate account table.
+ */
 function migrate_example_advanced_data_account() {
-  $fields = array('accountid', 'status', 'posted', 'last_access', 'last_login',
-    'name', 'sex', 'password', 'mail', 'original_mail', 'sig', 'imageid', 'positions');
+  $fields = [
+    'accountid',
+    'status',
+    'posted',
+    'last_access',
+    'last_login',
+    'name',
+    'sex',
+    'password',
+    'mail',
+    'original_mail',
+    'sig',
+    'imageid',
+    'positions',
+  ];
   $query = db_insert('migrate_example_advanced_account')
     ->fields($fields);
-  $data = array(
-    array(1, 1, '2010-03-30 10:31:05', '2010-04-30 18:25:24', '2010-04-30 14:01:02',
-      'darren', 'M', 'dpass', 'ddarren@example.com', 'darren@example.com',
-      'All about the Australians', NULL, '5'),
-    array(3, 0, '2007-03-15 10:31:05', '2007-06-10 04:11:38', '2007-06-10 04:11:38',
-      'emily', 'F', 'insecure', 'emily@example.com', 'emily@example.com',
-      'Sommelier to the stars', NULL, '18'),
-    array(9, 1, '2004-02-29 10:31:05', '2004-02-29 10:31:05', '2004-02-29 10:31:05',
-      'fonzie', NULL, 'bike', 'thefonz@example.com', 'arthur@example.com',
-      'Aaay!', 1, '5,18'),
-  );
+  $data = [
+    [
+      1,
+      1,
+      '2010-03-30 10:31:05',
+      '2010-04-30 18:25:24',
+      '2010-04-30 14:01:02',
+      'darren',
+      'M',
+      'dpass',
+      'ddarren@example.com',
+      'darren@example.com',
+      'All about the Australians',
+      NULL,
+      '5',
+    ],
+    [
+      3,
+      0,
+      '2007-03-15 10:31:05',
+      '2007-06-10 04:11:38',
+      '2007-06-10 04:11:38',
+      'emily',
+      'F',
+      'insecure',
+      'emily@example.com',
+      'emily@example.com',
+      'Sommelier to the stars',
+      NULL,
+      '18',
+    ],
+    [
+      9,
+      1,
+      '2004-02-29 10:31:05',
+      '2004-02-29 10:31:05',
+      '2004-02-29 10:31:05',
+      'fonzie',
+      NULL,
+      'bike',
+      'thefonz@example.com',
+      'arthur@example.com',
+      'Aaay!',
+      1,
+      '5,18',
+    ],
+  ];
   foreach ($data as $row) {
     $query->values(array_combine($fields, $row));
   }
   $query->execute();
 }
 
+/**
+ * Populate account updates table.
+ */
 function migrate_example_advanced_data_account_updates() {
-  $fields = array('accountid', 'sex');
+  $fields = ['accountid', 'sex'];
   $query = db_insert('migrate_example_advanced_account_updates')
-           ->fields($fields);
-  $data = array(
-    array(1, NULL),
-    array(3, 'M'),
-    array(9, 'F'),
-  );
+    ->fields($fields);
+  $data = [
+    [1, NULL],
+    [3, 'M'],
+    [9, 'F'],
+  ];
   foreach ($data as $row) {
     $query->values(array_combine($fields, $row));
   }
   $query->execute();
 }
 
+/**
+ * Populate comment table.
+ */
 function migrate_example_advanced_data_comment() {
-  $fields = array('commentid', 'wineid', 'comment_parent', 'subject', 'body',
-    'name', 'mail', 'accountid', 'commenthost', 'userpage', 'posted', 'lastchanged');
+  $fields = [
+    'commentid',
+    'wineid',
+    'comment_parent',
+    'subject',
+    'body',
+    'name',
+    'mail',
+    'accountid',
+    'commenthost',
+    'userpage',
+    'posted',
+    'lastchanged',
+  ];
   $query = db_insert('migrate_example_advanced_comment')
     ->fields($fields);
-  $data = array(
-    array(1, 1, NULL, 'im first', 'Tasty', 'grace', 'grace@example.com', 0,
-      '123.456.78.9', 'http:://grace.example.com/',
-      strtotime('2010-01-02 03:04:05'), strtotime('2010-04-05 06:07:08')),
-    array(2, 1, NULL, 'im second', 'Delicious', 'horace', 'horace@example.com', 0,
-      'example.com', NULL,
-      strtotime('2010-02-02 03:04:05'), strtotime('2010-05-05 06:07:08')),
-    array(3, 1, NULL, 'im parent', 'Don\'t care for it', 'irene', 'irene@example.com', 0,
-      '254.0.2.5', 'http:://www.example.com/irene',
-      strtotime('2010-03-02 03:04:05'), strtotime('2010-03-02 03:04:05')),
-    array(4, 1, 3, 'im child', 'But it\'s so good!', 'emily', NULL, 3,
-      '58.29.126.1', 'http:://www.wine.com/',
-      strtotime('2010-01-02 03:04:05'), strtotime('2010-01-02 03:04:05')),
-    array(5, 1, 4, 'im grandchild', 'Right on, Emily!', 'thefonz@example.com', NULL, 9,
-      '123.456.78.9', NULL,
-      strtotime('2010-06-02 03:04:05'), strtotime('2010-06-02 03:04:05')),
-  );
+  $data = [
+    [
+      1,
+      1,
+      NULL,
+      'im first',
+      'Tasty',
+      'grace',
+      'grace@example.com',
+      0,
+      '123.456.78.9',
+      'http:://grace.example.com/',
+      strtotime('2010-01-02 03:04:05'),
+      strtotime('2010-04-05 06:07:08'),
+    ],
+    [
+      2,
+      1,
+      NULL,
+      'im second',
+      'Delicious',
+      'horace',
+      'horace@example.com',
+      0,
+      'example.com',
+      NULL,
+      strtotime('2010-02-02 03:04:05'),
+      strtotime('2010-05-05 06:07:08'),
+    ],
+    [
+      3,
+      1,
+      NULL,
+      'im parent',
+      'Don\'t care for it',
+      'irene',
+      'irene@example.com',
+      0,
+      '254.0.2.5',
+      'http:://www.example.com/irene',
+      strtotime('2010-03-02 03:04:05'),
+      strtotime('2010-03-02 03:04:05'),
+    ],
+    [
+      4,
+      1,
+      3,
+      'im child',
+      'But it\'s so good!',
+      'emily',
+      NULL,
+      3,
+      '58.29.126.1',
+      'http:://www.wine.com/',
+      strtotime('2010-01-02 03:04:05'),
+      strtotime('2010-01-02 03:04:05'),
+    ],
+    [
+      5,
+      1,
+      4,
+      'im grandchild',
+      'Right on, Emily!',
+      'thefonz@example.com',
+      NULL,
+      9,
+      '123.456.78.9',
+      NULL,
+      strtotime('2010-06-02 03:04:05'),
+      strtotime('2010-06-02 03:04:05'),
+    ],
+  ];
   foreach ($data as $row) {
     $query->values(array_combine($fields, $row));
   }
   $query->execute();
 }
 
+/**
+ * Populate comment updates table.
+ */
 function migrate_example_advanced_data_comment_updates() {
-  $fields = array('commentid', 'subject');
+  $fields = ['commentid', 'subject'];
   $query = db_insert('migrate_example_advanced_comment_updates')
-           ->fields($fields);
-  $data = array(
-    array(1, 'I am first'),
-    array(2, 'I am second'),
-    array(3, 'I am parent'),
-    array(4, ''),
-    array(5, 'I am Spartacus'),
-  );
+    ->fields($fields);
+  $data = [
+    [1, 'I am first'],
+    [2, 'I am second'],
+    [3, 'I am parent'],
+    [4, ''],
+    [5, 'I am Spartacus'],
+  ];
   foreach ($data as $row) {
     $query->values(array_combine($fields, $row));
   }
   $query->execute();
 }
 
+/**
+ * Populate categories table.
+ */
 function migrate_example_advanced_data_categories() {
-  $fields = array('categoryid', 'type', 'name', 'category_parent', 'details', 'ordering');
+  $fields = [
+    'categoryid',
+    'type',
+    'name',
+    'category_parent',
+    'details',
+    'ordering',
+  ];
   $query = db_insert('migrate_example_advanced_categories')
-           ->fields($fields);
-  $data = array(
-    array(1, 'variety', 'White wine', NULL, 'White wines are generally simpler and sweeter than red', 3),
-    array(3, 'variety', 'Red wine', NULL, 'Red wines are generally more complex and "dry" than white', 1),
-    array(8, 'variety', 'Riesling', 1, 'Associated with Germany', 2),
-    array(9, 'variety', 'Chardonnay', 1, 'One of the most popular whites', 1),
-    array(13, 'variety', 'Merlot', 3, 'Very drinkable', 4),
-    array(14, 'variety', 'Syrah', 3, 'A.k.a. shiraz', -3),
-    array(25, 'variety', 'Cabernet Sauvignon', 3, 'A basic', -5),
-    array(26, 'variety', "Nero d'Avola", 3, 'Sicilian specialty', 2),
-    array(2, 'region', 'Italy', NULL, 'Largest producer of wine', 5),
-    array(11, 'region', 'Tuscany', 2, NULL, 2),
-    array(18, 'region', 'Chianti', 11, NULL, -1),
-    array(19, 'region', 'Elba', 11, NULL, 5),
-    array(4, 'region', 'France', NULL, 'C\'est bon', 6),
-    array(5, 'region', 'Bordeaux', 4, NULL, 1),
-    array(6, 'region', 'Barsac', 5, NULL, 3),
-    array(7, 'region', 'Pomerol', 5, NULL, 2),
-    array(16, 'region', 'Chile', NULL, NULL, 3),
-    array(17, 'region', 'Colchagua Valley', 16, NULL, 1),
-    array(20, 'region', 'California', NULL, NULL, 5),
-    array(21, 'region', 'Redwood Valley', 20, NULL, 1),
-    array(10, 'best_with', 'Beef', NULL, NULL, 5),
-    array(12, 'best_with', 'Pork', NULL, NULL, -3),
-    array(15, 'best_with', 'Chicken', NULL, NULL, -5),
-  );
+    ->fields($fields);
+  $data = [
+    [
+      1,
+      'variety',
+      'White wine',
+      NULL,
+      'White wines are generally simpler and sweeter than red',
+      3,
+    ],
+    [
+      3,
+      'variety',
+      'Red wine',
+      NULL,
+      'Red wines are generally more complex and "dry" than white',
+      1,
+    ],
+    [8, 'variety', 'Riesling', 1, 'Associated with Germany', 2],
+    [9, 'variety', 'Chardonnay', 1, 'One of the most popular whites', 1],
+    [13, 'variety', 'Merlot', 3, 'Very drinkable', 4],
+    [14, 'variety', 'Syrah', 3, 'A.k.a. shiraz', -3],
+    [25, 'variety', 'Cabernet Sauvignon', 3, 'A basic', -5],
+    [26, 'variety', "Nero d'Avola", 3, 'Sicilian specialty', 2],
+    [2, 'region', 'Italy', NULL, 'Largest producer of wine', 5],
+    [11, 'region', 'Tuscany', 2, NULL, 2],
+    [18, 'region', 'Chianti', 11, NULL, -1],
+    [19, 'region', 'Elba', 11, NULL, 5],
+    [4, 'region', 'France', NULL, 'C\'est bon', 6],
+    [5, 'region', 'Bordeaux', 4, NULL, 1],
+    [6, 'region', 'Barsac', 5, NULL, 3],
+    [7, 'region', 'Pomerol', 5, NULL, 2],
+    [16, 'region', 'Chile', NULL, NULL, 3],
+    [17, 'region', 'Colchagua Valley', 16, NULL, 1],
+    [20, 'region', 'California', NULL, NULL, 5],
+    [21, 'region', 'Redwood Valley', 20, NULL, 1],
+    [10, 'best_with', 'Beef', NULL, NULL, 5],
+    [12, 'best_with', 'Pork', NULL, NULL, -3],
+    [15, 'best_with', 'Chicken', NULL, NULL, -5],
+  ];
   foreach ($data as $row) {
     $query->values(array_combine($fields, $row));
   }
   $query->execute();
 }
 
+/**
+ * Populate vintages table.
+ */
 function migrate_example_advanced_data_vintages() {
-  $fields = array('wineid', 'vintage');
+  $fields = ['wineid', 'vintage'];
   $query = db_insert('migrate_example_advanced_vintages')
-           ->fields($fields);
-  $data = array(
-    array(1, 2006),
-    array(1, 2007),
-    array(2, 2001),
-  );
+    ->fields($fields);
+  $data = [
+    [1, 2006],
+    [1, 2007],
+    [2, 2001],
+  ];
   foreach ($data as $row) {
     $query->values(array_combine($fields, $row));
   }
   $query->execute();
 }
 
+/**
+ * Populate variety updates table.
+ */
 function migrate_example_advanced_data_variety_updates() {
-  $fields = array('categoryid', 'details');
+  $fields = ['categoryid', 'details'];
   $query = db_insert('migrate_example_advanced_variety_updates')
-           ->fields($fields);
-  $data = array(
-    array(1, 'White wines are simpler and sweeter than red'),
-    array(3, 'Red wines are generally more complex and dry than white'),
-    array(8, 'Usually associated with Germany'),
-    array(9, NULL),
-    array(13, 'Common, very drinakable'),
-    array(14, 'AKA Shiraz'),
-    array(25, 'Basic'),
-    array(26, 'A specialty of Sicily'),
-  );
+    ->fields($fields);
+  $data = [
+    [1, 'White wines are simpler and sweeter than red'],
+    [3, 'Red wines are generally more complex and dry than white'],
+    [8, 'Usually associated with Germany'],
+    [9, NULL],
+    [13, 'Common, very drinakable'],
+    [14, 'AKA Shiraz'],
+    [25, 'Basic'],
+    [26, 'A specialty of Sicily'],
+  ];
   foreach ($data as $row) {
     $query->values(array_combine($fields, $row));
   }
   $query->execute();
 }
 
+/**
+ * Populate category wine table.
+ */
 function migrate_example_advanced_data_category_wine() {
-  $fields = array('wineid', 'categoryid');
+  $fields = ['wineid', 'categoryid'];
   $query = db_insert('migrate_example_advanced_category_wine')
     ->fields($fields);
-  $data = array(
-    array(1, 12),
-    array(1, 15),
-    array(2, 10),
-  );
+  $data = [
+    [1, 12],
+    [1, 15],
+    [2, 10],
+  ];
   foreach ($data as $row) {
     $query->values(array_combine($fields, $row));
   }
   $query->execute();
 }
 
+/**
+ * Populate category producer table.
+ */
 function migrate_example_advanced_data_category_producer() {
-  $fields = array('producerid', 'categoryid');
+  $fields = ['producerid', 'categoryid'];
   $query = db_insert('migrate_example_advanced_category_producer')
     ->fields($fields);
-  $data = array(
-    array(1, 17),
-  );
+  $data = [
+    [1, 17],
+  ];
   foreach ($data as $row) {
     $query->values(array_combine($fields, $row));
   }
   $query->execute();
 }
 
+/**
+ * Populate files table.
+ */
 function migrate_example_advanced_data_files() {
-  $fields = array('imageid', 'url', 'image_alt', 'image_title', 'wineid');
+  $fields = ['imageid', 'url', 'image_alt', 'image_title', 'wineid'];
   $query = db_insert('migrate_example_advanced_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),
-  );
+  $data = [
+    [
+      1,
+      'http://placekitten.com/200/200',
+      NULL,
+      NULL,
+      NULL,
+    ],
+    [
+      2,
+      'http://cyrve.com/files/penguin.jpeg',
+      'Penguin alt',
+      'Penguin title',
+      1,
+    ],
+    [3, 'http://cyrve.com/files/rioja.jpeg', 'Rioja alt', 'Rioja title', 2],
+    [
+      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();
 }
 
+/**
+ * Populate blobs table.
+ */
 function migrate_example_advanced_data_blobs() {
   $blob = file_get_contents('core/misc/druplicon.png');
-  $fields = array('imageid', 'imageblob');
+  $fields = ['imageid', 'imageblob'];
   $query = db_insert('migrate_example_advanced_blobs')
     ->fields($fields);
-  $data = array(
-    array(1, $blob),
-  );
+  $data = [
+    [1, $blob],
+  ];
   foreach ($data as $row) {
     $query->values(array_combine($fields, $row));
   }
   $query->execute();
 }
 
+/**
+ * Populate table source table.
+ */
 function migrate_example_advanced_data_table_source() {
-  $fields = array('fooid', 'field1', 'field2');
+  $fields = ['fooid', 'field1', 'field2'];
   $query = db_insert('migrate_example_advanced_table_source')
     ->fields($fields);
-  $data = array(
-    array(3, 'Some sample data', 58),
-    array(15, 'Whatever', 2),
-    array(646, 'More sample data', 34989),
-  );
+  $data = [
+    [3, 'Some sample data', 58],
+    [15, 'Whatever', 2],
+    [646, 'More sample data', 34989],
+  ];
   foreach ($data as $row) {
     $query->values(array_combine($fields, $row));
   }