I use both parent mappings: Parent Guid and Parent Name.
The case of using such approach is when the source provides some kind of fallback if the parent is not specified directly, i.e.:

      if (!empty($parent_id)) {
        $item['parent_guid'] = $guid;
      } else {
        $item['parent_name'] = $fallback_name;
      }

But in some reason in FeedsTermProcessor hardcoded that if parent's (guid, name) value is empty it is necessary to put zero (top level) to the term object.
So, even though zero level is default for terms and in next iteration other mapping might set the real parent, it always goes to the top level.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Sergii’s picture

Status: Active » Needs review
FileSize
1.55 KB

Please review.

Sergii’s picture

Version: 7.x-2.x-dev » 7.x-2.0-alpha7
FileSize
1.22 KB

Update patch to alpha7.

sdrycroft’s picture

Version: 7.x-2.0-alpha7 » 7.x-2.x-dev
Issue summary: View changes
FileSize
1.44 KB

I have just run into this exact same issue. The enclosed patch is for the latest dev release. This really is a no-brainer, and should be applied ASAP.

Status: Needs review » Needs work

The last submitted patch, 3: feeds_guid_and_parent_name.patch, failed testing.

sdrycroft’s picture

Status: Needs work » Needs review
FileSize
2.06 KB

The previous patch is failing due to a completely unrelated error/exception. The attached patch fixes that too.

Andrew Gorokhovets’s picture

MegaChriz’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

This needs tests that ensure the following:

  • When mapping first to "Parent: GUID" and secondly to "Parent: Term name", and for at least one of these targets there is a value, the imported term should get a parent.
  • When mapping first to "Parent: Term name" and secondly to "Parent: GUID", and for at least one of these targets there is a value, the imported term should get a parent.
  • When updating existing terms and mapping to "Parent: GUID", importing an empty value for that target should result in the term becoming parentless.
  • When updating existing terms and mapping to "Parent: Term name", importing an empty value for that target should result in the term becoming parentless.
  • When updating existing terms and mapping to both "Parent: GUID" and "Parent: Term name" and values for both targets are empty, the term should become parentless.
Andrew Gorokhovets’s picture

Thank you MegaChriz!
You are right. Autotests really needed for this. I try to do it ASAP.
Also I updated a patch, it was required after testing.

MegaChriz’s picture

@Andrew Gorokhovets
Great that you want to develop the automated tests. If you hit any roadblocks or have any questions during the development of the tests, don't hesitate to ask for help! Maybe with a simple answer or hint you can continue.