I have a XML that has multiple occurrances of the same item like this:

<root>
<person>
<ref value="A" />
<ref value="B" />
<ref value="C" />
</person>
<person>
<ref value="A" />
<ref value="D" />
</person>
<person>
<ref value="E" />
<ref value="H" />
</person>
...
</root>

I want to migrate the ref-values as sub-values into a field that allows multiple values.

Person1

References
A
B
C

etc.

I can up set field_reference with the xpath "ref/@value", but do to a loop in fetchNextRow() in

class Xml extends DataParserPluginBase implements ContainerFactoryPluginInterface

I would only get the last value

Any suggestions on how to fix this would be welcome.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

killes@www.drop.org created an issue. See original summary.

mikeryan’s picture

Category: Support request » Bug report
Status: Active » Needs work
FileSize
7.19 KB

Yep, the attached patch adds a multi-value field to the example wine_variety_multi_xml migration that demonstrates this - definitely a bug.

mikeryan’s picture

Status: Needs work » Needs review
FileSize
8.05 KB
771 bytes

@killes@www.drop.org: Does this work for you?

killes@www.drop.org’s picture

Status: Needs review » Reviewed & tested by the community

Yes, thank you, this works!

  • mikeryan committed 76dff06 on 8.x-2.x
    Issue #2730375 by mikeryan: XML: multiple values into Multi-Field
    
mikeryan’s picture

Status: Reviewed & tested by the community » Fixed

Committed, thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.