migrate_plus.migration.wine_variety_list.yml.txt 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. # This migration demonstrates importing from an endpoint listing other endpoints
  2. # containing individual item data.
  3. id: wine_variety_list
  4. label: XML feed of varieties
  5. migration_group: wine
  6. source:
  7. # We use the XML source plugin.
  8. plugin: xml
  9. # Normally, this is one or more fully-qualified URLs or file paths. Because
  10. # we can't hardcode your local URL, we provide a relative path here which
  11. # hook_install() will rewrite to a full URL for the current site.
  12. urls: /migrate_example_advanced_variety_list?_format=xml
  13. item_url: /migrate_example_advanced_variety_list/:id?_format=xml
  14. id_selector: /response/items
  15. # Visit the URL above (relative to your site root) and look at it. You can see
  16. # that <response> is the outer element, and each item we want to import is a
  17. # <position> element. The item_xpath value is the xpath to use to query the
  18. # desired elements.
  19. item_selector: /response/variety
  20. # Under 'fields', we list the data items to be imported. The first level keys
  21. # are the source field names we want to populate (the names to be used as
  22. # sources in the process configuration below). For each field we're importing,
  23. # we provide a label (optional - this is for display in migration tools) and
  24. # an xpath for retrieving that value. It's important to note that this xpath
  25. # is relative to the elements retrieved by item_xpath.
  26. fields:
  27. category_name:
  28. label:
  29. selector: name
  30. category_details:
  31. label:
  32. selector: details
  33. category_parent:
  34. label: 'Unique position identifier'
  35. selector: parent
  36. # Under 'ids', we identify source fields populated above which will uniquely
  37. # identify each imported item. The 'type' makes sure the migration map table
  38. # uses the proper schema type for stored the IDs.
  39. ids:
  40. category_name:
  41. type: string
  42. process:
  43. vid:
  44. plugin: default_value
  45. default_value: migrate_example_wine_varieties
  46. name: category_name
  47. description: category_details
  48. parent:
  49. plugin: migration
  50. migration: wine_terms
  51. source: category_parent
  52. destination:
  53. plugin: entity:taxonomy_term
  54. migration_dependencies:
  55. require:
  56. - wine_terms