FeedsTermProcessor doesn't support referencing multiple parents in the parentguid target. It only imports the first one.

Comments

miiimooo’s picture

StatusFileSize
new902 bytes

Attached find simple patch to fix this problem. If you use for instance feeds_tamper to explode multiple parent references, this will correctly write multiple parents.

miiimooo’s picture

Status: Active » Needs review
miiimooo’s picture

StatusFileSize
new965 bytes

The previous patch breaks single values. This patch fixes mappings that don't have multiple values.

twistor’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests
  1. +++ b/plugins/FeedsTermProcessor.inc
    @@ -115,8 +115,12 @@ class FeedsTermProcessor extends FeedsProcessor {
    +        $value = (is_array($value) ? $value : array($value));
    

    Extra parens.

  2. +++ b/plugins/FeedsTermProcessor.inc
    @@ -115,8 +115,12 @@ class FeedsTermProcessor extends FeedsProcessor {
    +        $result = $query->condition('guid', $value, "IN")->execute();
    +        while($row = $result->fetchObject()) {
    +          $target_term->parent[] = ($row->entity_id ? $row->entity_id : 0);
    +        }
    

    No need for the while() here. Just foreach over the query.

    Also, no need for the condition, on $row->entity_id.

  3. +++ b/plugins/FeedsTermProcessor.inc
    @@ -115,8 +115,12 @@ class FeedsTermProcessor extends FeedsProcessor {
    +        $target_term->parent = (isset($target_term->parent) ? $target_term->parent : array(0));
    

    Extra parens.

If you broke this without the test failing, then we need test coverage of this.

bluegeek9’s picture

Status: Needs work » Closed (outdated)
//www.flaticon.com/free-icons/thank-you Thank you for your contribution!

Unfortunately, Drupal 7 is End of Life and no longer supported. We strongly encourage you to upgrade to a supported version of Drupal.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.