3

I have a simple example the uses an entity reference field that references taxonomy terms (e.g. "Arranger"). On import I need feeds to see if the term exists, reference it. If it doesn't exist, create and then reference it:

My CSV: enter image description here

My Feed Mapping: enter image description here

It imports everything else but not the entity reference field. It doesn't create the term either.

What do my feed mapping need to look like to allow entity reference to check for and if the term doesn't exist, create it (and then reference it)?

5
  • Are you using the module Entity Reference Feeds? Apr 28, 2014 at 18:01
  • No. Should I be? If so how do I use it in this situation? I tried to use it originally but it didn't have very good documentation and I failed to figure it out on my own. Apr 28, 2014 at 18:13
  • Well, I suspect that could help you. A quick scan of this issue (drupal.org/node/1341012) in the Feeds issue queue leads me to think that integration of Feeds and Entity Reference is still not optimal. I think the module I referenced in my first comment attempts to address that. Unfortunately I don't have any experience with the Entity Reference Feeds module, so it is hard for me to address any specific questions you might have about the module itself. Apr 28, 2014 at 20:07
  • From your images i can't figure out which is your "entity reference field", can you please point it out for me ?
    – D34dman
    May 6, 2014 at 12:12
  • sorry, "arranger" is the entity reference field. May 6, 2014 at 16:06

4 Answers 4

5

Perhaps the Feeds Tamper: String to ID module might in this situation?

A Feeds + Feeds Tamper plugin that resolves strings pulled in from feeds importers and maps them to Drupal entity IDs, so they can be used as entity references.

Adds support for freeform Entityreference linking when using Feeds.

1
  • Can you provide some more detail on how to use it in this situation? May 9, 2014 at 21:00
0

What version of feeds are you using? You mention in one place it's an entity reference and another that it's a taxonomy term.

If it's taxonomy feeds 2.x alpha8 will work, you need to use tax term.

To get entity references working you need to use Entity reference feeds module.

Provides feeds integration for entityreference for mapping directly to properties of referenced entities.

  • Utilizes Entity API to provide mapping targets for entity properties.
  • Will automatically create new referenced entities and update existing ones using a GUID mapping to separate between the two.
  • Set default values for required entity properties and avoid being forced to map them in Feeds
2
  • I am using the latest stable release of feeds and I am using entity reference to reference taxonomy terms. There is also no documentation with Entity Reference Feeds that cover this use-case. The example on the project page uses XML and doesn't discuss how to map it. I need help on how to map this properly. May 10, 2014 at 3:08
  • Same issue here. What are the Entity Reference etid and label ? I don't know what I am supposed to map in my importer and what they correspond to in my referenced content type.
    – MrUpsidown
    Jul 27, 2015 at 16:54
0

I had a similar problem passing values from a feeds source to Entity reference fields on a node.

I solved my problem by using Views Bulk Operations to manually set the the values for the entity reference fields after the feed had created/updated the node.

I appreciate that this isn't an elegant solution but if you only have 3-5 entities that are referenced it will work quickly and it is simple to set up...

1
  • Unfortunately there are around 20 entity reference fields on this content type alone with a possible combination of thousands of terms to reference. It is a huge choir music database. It looks like until I figure out how to do it properly, I am going to have to import the vocabs/terms first, then import the content that references them. Jun 23, 2014 at 16:52
0

Kinda late but you can use hook_feeds_after_parse and alter the results from your csv file before importing. In your case, convert the csv-field which I guess is the name of the taxonomy term (the one that you want to map to the entity (taxonomy) reference) into its tid and select Entity reference by Entity ID in the Feeds UI target list.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.