Commit 9f91a2b8 authored by heddn's avatar heddn Committed by heddn

Issue #2939526 by davewilly, heddn, Frank Ralf: Unused...

Issue #2939526 by davewilly, heddn, Frank Ralf: Unused migrate_plus.migration.wine_variety_list.yml.txt example + test fixes
parent 5e1715b2
......@@ -316,7 +316,7 @@ function migrate_example_beer_data_node() {
'image_title',
'image_description',
];
$query = db_insert('migrate_example_beer_node')
$query = \Drupal::database()->insert('migrate_example_beer_node')
->fields($fields);
// Use high bid numbers to avoid overwriting an existing node id.
$data = [
......@@ -381,7 +381,7 @@ function migrate_example_beer_data_account() {
'sex',
'beers',
];
$query = db_insert('migrate_example_beer_account')
$query = \Drupal::database()->insert('migrate_example_beer_account')
->fields($fields);
$data = [
[
......@@ -436,7 +436,7 @@ function migrate_example_beer_data_account() {
*/
function migrate_example_beer_data_comment() {
$fields = ['bid', 'cid_parent', 'subject', 'body', 'name', 'mail', 'aid'];
$query = db_insert('migrate_example_beer_comment')
$query = \Drupal::database()->insert('migrate_example_beer_comment')
->fields($fields);
$data = [
[99999998, NULL, 'im first', 'full body', 'alice', 'alice@example.com', 0],
......@@ -464,7 +464,7 @@ function migrate_example_beer_data_comment() {
*/
function migrate_example_beer_data_topic() {
$fields = ['style', 'details', 'style_parent', 'region', 'hoppiness'];
$query = db_insert('migrate_example_beer_topic')
$query = \Drupal::database()->insert('migrate_example_beer_topic')
->fields($fields);
$data = [
['ale', 'traditional', NULL, 'Medieval British Isles', 'Medium'],
......@@ -488,7 +488,7 @@ function migrate_example_beer_data_topic() {
*/
function migrate_example_beer_data_topic_node() {
$fields = ['bid', 'style'];
$query = db_insert('migrate_example_beer_topic_node')
$query = \Drupal::database()->insert('migrate_example_beer_topic_node')
->fields($fields);
$data = [
[99999999, 'pilsner'],
......
# This migration demonstrates importing from an endpoint listing other endpoints
# containing individual item data.
id: wine_variety_list
label: XML feed of varieties
migration_group: wine
migration_tags:
- advanced example
source:
# We use the XML source plugin.
plugin: xml
# Normally, this is one or more fully-qualified URLs or file paths. Because
# we can't hardcode your local URL, we provide a relative path here which
# hook_install() will rewrite to a full URL for the current site.
urls:
- /migrate_example_advanced_variety_list?_format=xml
item_url: /migrate_example_advanced_variety_list/:id?_format=xml
id_selector: /response/items
# Visit the URL above (relative to your site root) and look at it. You can see
# that <response> is the outer element, and each item we want to import is a
# <position> element. The item_xpath value is the xpath to use to query the
# desired elements.
item_selector: /response/variety
# Under 'fields', we list the data items to be imported. The first level keys
# are the source field names we want to populate (the names to be used as
# sources in the process configuration below). For each field we're importing,
# we provide a label (optional - this is for display in migration tools) and
# an xpath for retrieving that value. It's important to note that this xpath
# is relative to the elements retrieved by item_xpath.
fields:
category_name:
label:
selector: name
category_details:
label:
selector: details
category_parent:
label: 'Unique position identifier'
selector: parent
# Under 'ids', we identify source fields populated above which will uniquely
# identify each imported item. The 'type' makes sure the migration map table
# uses the proper schema type for stored the IDs.
ids:
category_name:
type: string
process:
vid:
plugin: default_value
default_value: migrate_example_wine_varieties
name: category_name
description: category_details
parent:
plugin: migration_lookup
migration: wine_terms
source: category_parent
destination:
plugin: entity:taxonomy_term
migration_dependencies:
require:
- wine_terms
......@@ -737,7 +737,7 @@ function migrate_example_advanced_data_wine() {
'region',
'rating',
];
$query = db_insert('migrate_example_wine')
$query = \Drupal::database()->insert('migrate_example_wine')
->fields($fields);
$data = [
[
......@@ -776,7 +776,7 @@ function migrate_example_advanced_data_wine() {
*/
function migrate_example_advanced_data_updates() {
$fields = ['wineid', 'rating'];
$query = db_insert('migrate_example_advanced_updates')
$query = \Drupal::database()->insert('migrate_example_advanced_updates')
->fields($fields);
$data = [
[1, 93],
......@@ -793,7 +793,7 @@ function migrate_example_advanced_data_updates() {
*/
function migrate_example_advanced_data_producer() {
$fields = ['producerid', 'name', 'body', 'excerpt', 'accountid'];
$query = db_insert('migrate_example_advanced_producer')
$query = \Drupal::database()->insert('migrate_example_advanced_producer')
->fields($fields);
$data = [
[1, 'Montes', 'Fine Chilean winery', 'Great!', 9],
......@@ -824,7 +824,7 @@ function migrate_example_advanced_data_account() {
'imageid',
'positions',
];
$query = db_insert('migrate_example_advanced_account')
$query = \Drupal::database()->insert('migrate_example_advanced_account')
->fields($fields);
$data = [
[
......@@ -884,7 +884,7 @@ function migrate_example_advanced_data_account() {
*/
function migrate_example_advanced_data_account_updates() {
$fields = ['accountid', 'sex'];
$query = db_insert('migrate_example_advanced_account_updates')
$query = \Drupal::database()->insert('migrate_example_advanced_account_updates')
->fields($fields);
$data = [
[1, NULL],
......@@ -915,7 +915,7 @@ function migrate_example_advanced_data_comment() {
'posted',
'lastchanged',
];
$query = db_insert('migrate_example_advanced_comment')
$query = \Drupal::database()->insert('migrate_example_advanced_comment')
->fields($fields);
$data = [
[
......@@ -1000,7 +1000,7 @@ function migrate_example_advanced_data_comment() {
*/
function migrate_example_advanced_data_comment_updates() {
$fields = ['commentid', 'subject'];
$query = db_insert('migrate_example_advanced_comment_updates')
$query = \Drupal::database()->insert('migrate_example_advanced_comment_updates')
->fields($fields);
$data = [
[1, 'I am first'],
......@@ -1027,7 +1027,7 @@ function migrate_example_advanced_data_categories() {
'details',
'ordering',
];
$query = db_insert('migrate_example_advanced_categories')
$query = \Drupal::database()->insert('migrate_example_advanced_categories')
->fields($fields);
$data = [
[
......@@ -1079,7 +1079,7 @@ function migrate_example_advanced_data_categories() {
*/
function migrate_example_advanced_data_vintages() {
$fields = ['wineid', 'vintage'];
$query = db_insert('migrate_example_advanced_vintages')
$query = \Drupal::database()->insert('migrate_example_advanced_vintages')
->fields($fields);
$data = [
[1, 2006],
......@@ -1097,7 +1097,7 @@ function migrate_example_advanced_data_vintages() {
*/
function migrate_example_advanced_data_variety_updates() {
$fields = ['categoryid', 'details'];
$query = db_insert('migrate_example_advanced_variety_updates')
$query = \Drupal::database()->insert('migrate_example_advanced_variety_updates')
->fields($fields);
$data = [
[1, 'White wines are simpler and sweeter than red'],
......@@ -1120,7 +1120,7 @@ function migrate_example_advanced_data_variety_updates() {
*/
function migrate_example_advanced_data_category_wine() {
$fields = ['wineid', 'categoryid'];
$query = db_insert('migrate_example_advanced_category_wine')
$query = \Drupal::database()->insert('migrate_example_advanced_category_wine')
->fields($fields);
$data = [
[1, 12],
......@@ -1138,7 +1138,7 @@ function migrate_example_advanced_data_category_wine() {
*/
function migrate_example_advanced_data_category_producer() {
$fields = ['producerid', 'categoryid'];
$query = db_insert('migrate_example_advanced_category_producer')
$query = \Drupal::database()->insert('migrate_example_advanced_category_producer')
->fields($fields);
$data = [
[1, 17],
......@@ -1154,7 +1154,7 @@ function migrate_example_advanced_data_category_producer() {
*/
function migrate_example_advanced_data_files() {
$fields = ['imageid', 'url', 'image_alt', 'image_title', 'wineid'];
$query = db_insert('migrate_example_advanced_files')
$query = \Drupal::database()->insert('migrate_example_advanced_files')
->fields($fields);
$data = [
[
......@@ -1192,7 +1192,7 @@ function migrate_example_advanced_data_files() {
function migrate_example_advanced_data_blobs() {
$blob = file_get_contents('core/misc/druplicon.png');
$fields = ['imageid', 'imageblob'];
$query = db_insert('migrate_example_advanced_blobs')
$query = \Drupal::database()->insert('migrate_example_advanced_blobs')
->fields($fields);
$data = [
[1, $blob],
......@@ -1208,7 +1208,7 @@ function migrate_example_advanced_data_blobs() {
*/
function migrate_example_advanced_data_table_source() {
$fields = ['fooid', 'field1', 'field2'];
$query = db_insert('migrate_example_advanced_table_source')
$query = \Drupal::database()->insert('migrate_example_advanced_table_source')
->fields($fields);
$data = [
[3, 'Some sample data', 58],
......
......@@ -2,6 +2,8 @@
id: product
label: JSON feed of Products
migration_group: Product
migration_tags:
- json example
source:
# We use the JSON source plugin.
plugin: url
......@@ -21,7 +23,8 @@ source:
# hashed source rows to determine whether incoming data has changed.
# track_changes: true
# Copy the example JSON file in artifacts folder to sites/default/files folder.
urls: 'public://migrate_json_example/products.json'
urls:
- 'public://migrate_json_example/products.json'
# An xpath-like selector corresponding to the items to be imported.
item_selector: product
# Under 'fields', we list the data items to be imported. The first level keys
......
......@@ -20,7 +20,10 @@ class LoadTest extends BrowserTestBase {
public static $modules = [
'migrate_plus',
'migrate_example',
'migrate_example_setup',
'migrate_example_advanced',
'migrate_example_advanced_setup',
'migrate_json_example',
];
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment