Entity Finder Plugin array compatibility (Explode Plugin)

Created on 7 May 2025, 3 days ago

Problem/Motivation

When trying to chain the Entity Finder plugin onto an array, it doesn't appear possible to do so. See error:

An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /en/batch?id=303&op=do_nojs&op=do
StatusText: error
ResponseText: The website encountered an unexpected error. Try again later.Drupal\Core\Database\InvalidQueryException: Calling Drupal\Core\Database\Query\Condition:: condition() without an array compatible operator is not supported. See https://www.drupal.org/node/3350985 in Drupal\Core\Database\Query\Condition->condition() (line 115 of core/lib/Drupal/Core/Database/Query/Condition.php). Drupal\Core\Database\Query\Select-
>condition ( 'node__field_example_id.field_example_id_value', Array, NULL) (Line: 77)
Drupal\Core\Entity\Query\Sql\Condition->compile(Object) (Line: 177)
Drupal\Core\Entity\Query\Sql\Query->compile() (Line: 82)
Drupal Core VEntity Query 5a1Query-compt el) (ne: 356 bject) (Line: 120
Drupal\tamper\Plugin\Tamper\EntityFinder->tamper(Array, Object) (Line: 120)
rupal\feeds_tamper\EventSubscriber\FeedsSubscriber->alterItem(Object, Object, Array) (Line: 78
Drupal\ feeds_tamper\EventSubscriber\FeedsSubscriber-›afterParse(Object, 'feeds parse', Object) (Line: 246)
Symfony\Component\EventDispatcher\EventDispatcher: :Symfony\Component\EventDispatcher\{closure} (Object,
'feeds parse', Object) (Line: 206)
Symfony\Component\EventDispatcher\EventDispatcher->callListeners(Array, 'feeds-parse', Object) (Line: 56)
Symfony\Component\EventDispatcher\EventDispatcher->dispatch(Object, 'feeds parse') (Line: 41)
Drupal\ feeds\FeedsExecutable->dispatchEvent('feeds-parse', Object) (Line: 243)
Drupal\feeds\FeedsExecutable->doParse(Object, Object) (Line: 107)
Drupal\ feeds\ FeedsExecutable->processItem(Object,
'parse', Array, Array) (Line: 297)

Steps to reproduce

  1. Set up a Feeds importer
  2. Add a field in your source that contains multiple IDs separated by a delimiter (e.g., "47\r49")
  3. Add the Explode plugin to this field to convert the string to an array
  4. Chain the Entity Finder plugin after the Explode plugin to find entities based on these IDs
  5. Run the import
  6. Observe the database error

Proposed resolution

Modify the Entity Finder plugin's tamper() method to handle both array and non-array inputs properly. The specific change is to modify the return statement to maintain the array structure when the input is an array

Remaining tasks

Apply the proposed patch, write tests and review

User interface changes

N/A

API changes

The Entity Finder plugin's tamper() method will now return an array of entity IDs when given an array input, instead of just the first entity ID.

Data model changes

N/A

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇧🇪Belgium baikho Antwerp, BE

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

Comments & Activities

  • Issue created by @baikho
  • @baikho opened merge request.
  • 🇳🇱Netherlands megachriz

    Thanks for filing a bug report. Perhaps the bug is that the plugin has set 'handle_multiples' to 'TRUE' in the annotation. Can you check that when you remove that if that also fixes the problem?

  • 🇧🇪Belgium baikho Antwerp, BE

    #3 I noticed the flag, but didn't read the description. However when trying to remove the flag and re-running, doesn't appear to work. For now I am sticking to the patch, will do some more investigation later. Thanks!

Production build 0.71.5 2024