If you have a term importer with a source that can set multiple parents to a single term you may want to use multiple columns as "Parent: term name". But his will result in errors if you have rows that don't have all parent rows fill (some terms have only 1 parent, some have 2, some have 3) because feeds will try to insert the same key multiple times to the term_hierarchy table (term_id and parent ID as 0 multiple times).
On my case the solution is just to eliminate this lines from FeedsTermProcessor.inc
--- a/plugins/FeedsTermProcessor.inc
+++ b/plugins/FeedsTermProcessor.inc
@@ -134,12 +134,6 @@ class FeedsTermProcessor extends FeedsProcessor {
if (!empty($parent_tid)) {
$target_term->parent[] = $parent_tid;
}
- else {
- $target_term->parent[] = 0;
- }
- }
- else {
- $target_term->parent[] = 0;
}
break;
case 'parentguid':
Because if you are setting the parent for a term you almost always don't need to set any missing parents as 0.
Comments
Comment #1
twistor commentedA patch would be helpful.
Comment #2
mstiPatch added against branch 7.x-2.x
Comment #4
mstiComment #5
twistor commented2: feeds-missing_parents-1822484-2.patch queued for re-testing.
Comment #7
bluegeek9 commentedDrupal 7 reached end of life and the D7 version of Feeds is no longer being developed. To keep the issue queue focused on supported versions, we’re closing older D7 issues.
If you still have questions about using Feeds on Drupal 7, feel free to ask. While we won’t fix D7 bugs anymore, we’re happy to offer guidance to help you move forward. You can do so by opening (or reopening) a D7 issue, or by reaching out in the #feeds channel on Drupal Slack.
If this issue is still relevant for Drupal 10+, please open a follow-up issue or merge request with proposed changes. Contributions are always welcome!