Error "this field cannot hold more than 1 values" when manually filling parsed source fields via FeedsSubscriber

Created on 23 September 2020, about 4 years ago
Updated 9 December 2023, 12 months ago

I have strange problem with filling parse values in function afterParse(ParseEvent $event) - here is example of code:

class FeedsSubscriber implements EventSubscriberInterface {
...
  public function afterParse(ParseEvent $event) {
    $result = $event->getParserResult();
    for ($i = 0; $i < $result->count(); $i++) {
      $item = $result->offsetGet($i);
      $item->set('full_id', 123);
    }
  }
}

'full_id' source field is mapped to standard Drupal 'field_full_id' text field (with allowed only 1 value)

This code works well, but Feeds show error on importing process:

The myEntity 1 failed to validate with the following errors:

    Full ID (field_full_id): Full ID: this field cannot hold more than 1 values. 

Please check your <a href=#>mappings</a>. 

If I comment out string $item->set('full_id', 123); - all works well.

If I allow 4 and more values in Drupal 'field_full_id' field - all becomes work well, but if I set lower limits (3, 2, 1) - the error is return.

Where can be the source of this problem?

🐛 Bug report
Status

RTBC

Component

Code

Created by

🇩🇪Germany slowflyer

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024