function migrate_example_beer_data_comment in Migrate 7.2
Same name and namespace in other branches
- 6.2 migrate_example/beer.install.inc \migrate_example_beer_data_comment()
1 call to migrate_example_beer_data_comment()
- migrate_example_beer_install in migrate_example/
beer.install.inc
File
- migrate_example/
beer.install.inc, line 708 - Set up for the beer (basic) example.
Code
function migrate_example_beer_data_comment() {
$fields = array(
'bid',
'cid_parent',
'subject',
'body',
'name',
'mail',
'aid',
);
$query = db_insert('migrate_example_beer_comment')
->fields($fields);
$data = array(
array(
99999998,
NULL,
'im first',
'hot body',
'alice',
'alice@example.com',
0,
),
array(
99999998,
NULL,
'im second',
'hot body',
'alice',
'alice@example.com',
0,
),
array(
99999999,
NULL,
'im parent',
'hot body',
'alice',
'alice@example.com',
0,
),
array(
99999999,
1,
'im child',
'cold body',
'bob',
NULL,
1,
),
array(
99999999,
2,
'im grandchild',
'bitter body',
'charlie@example.com',
NULL,
1,
),
);
foreach ($data as $row) {
$query
->values(array_combine($fields, $row));
}
$query
->execute();
}