Hey guys, I've got a CSV where every row contains details about a node and then a URL to a file.

Each of the nodes rows has an id number associated representing each specific node.

So eg:

id, node name, file url
1, farfitnugen, /documents/foo.pdf
1, farfitnugen, /documents/bar.pdf
2, farfitnugen, /documents/2foo.pdf
2, farfitnugen, /documents/2bar.pdf

Using the example above, I've got the migration working such that it creates one record for each node, and downloads and links the appropriate file, but it does not cycle all the entries.

I'm currently mapping by the id, can anyone provide a suggestion of how to get Migrate to import all the documents per node?

Comments

mcdoolz created an issue.

mcdoolz’s picture

I solved this by writing a complete and rollback function for my files migration class.

On complete, I look for the nodes by the row data and associate the newly created file with the file field. This is on a multifield and I had to install some patches for it to work.

I can't remember your name from the Drupal IRC, but thanks for the direction :D

jpoesen’s picture

I'm guessing you're using the ID field as unique identifier in your MigrateSQLMap, but the values in your example CSV are not unique. Once Migrate has imported record with id 1 it won't import other records that also have id 1.

You should ensure the ids are unique, or use more that one field in your MigrateSQLMap to indicate which combination of fields makes a record unique.