$item->get($source) returns null

Created on 2 April 2024, 8 months ago
Updated 3 April 2024, 8 months ago

Problem/Motivation

Trying to use the feeds tamper module to explode comma separated values in an XML file.

Steps to reproduce

Create feed type with XML parser.
Configure a target field with multivalues.
Trying to take in <somefield>value1, value2</somefield>.
Use feeds tamper explode plugin.
Drupal\tamper\Exception\TamperException: Input should be a string. in Drupal\tamper\Plugin\Tamper\Explode->tamper()

Debugged feeds_tamper/src/EventSubscriber/FeedsSubscriber.php

   protected function alterItem(ItemInterface $item, ParseEvent $event, array $tampers_by_source) {
    $tamperable_item = new TamperableFeedItemAdapter($item);
    foreach ($tampers_by_source as $source => $tampers) {
      try {
        // Get the value for a source.
        ksm($item);//has source data in it from XML
        $item_value = $item->get($source);
        ksm($item_value); //is null

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Component

Code

Created by

🇬🇧United Kingdom mchaplin

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024