function migrate_example_wine_data_comment in Migrate 7.2
Same name and namespace in other branches
- 6.2 migrate_example/wine.install.inc \migrate_example_wine_data_comment()
1 call to migrate_example_wine_data_comment()
- migrate_example_wine_install in migrate_example/
wine.install.inc
File
- migrate_example/
wine.install.inc, line 1130 - Set up for the wine (advanced) example.
Code
function migrate_example_wine_data_comment() {
$fields = array(
'commentid',
'wineid',
'comment_parent',
'subject',
'body',
'name',
'mail',
'accountid',
'commenthost',
'userpage',
'posted',
'lastchanged',
);
$query = db_insert('migrate_example_wine_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'),
),
);
foreach ($data as $row) {
$query
->values(array_combine($fields, $row));
}
$query
->execute();
}