List compare action fails with complex data

Created on 19 June 2025, 27 days ago

Problem/Motivation

If the lists contain data like e.g. entities, the $this->tokenService->getTokenData($name)->toArray(); converts those into array, but then they can't be compared with array_diff or array_intersect because those compare string values of each item with each other.

Proposed resolution

Implement manual diff and intersect instead.

🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

🇩🇪Germany jurgenhaas Gottmadingen

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

Comments & Activities

  • Issue created by @jurgenhaas
    • jurgenhaas committed f02066ea on 3.0.x
      Issue #3530974 by jurgenhaas: List compare action fails with complex...
    • jurgenhaas committed f0bb328d on 2.1.x
      Issue #3530974 by jurgenhaas: List compare action fails with complex...
  • 🇩🇪Germany jurgenhaas Gottmadingen
  • 🇩🇪Germany jurgenhaas Gottmadingen
  • 🇮🇪Ireland marksmith

    My model stopped working at this point after 2.1.8 to 2.1.9 update.

    I used list compare in the following situation:

    A node type entity and a user entity reference the same taxonomy list via reference fields that can have multiple values. I want to allow access to a logged in user to the node whenever there is any common term between the node and a user referencing the same taxonomies. The model below worked well with 2.1.8 but stopped working after updating to 2.1.9. I looked at the code, but cannot figure out how I should modify my model.

    array_diff gives the list of node terms (the first to compare), array_intersect is always empty.

  • 🇩🇪Germany jurgenhaas Gottmadingen

    Hey Mark, comments on closed issues are usually lost. Please report something like this in a new issue. And then provide more details on how that can be reproduced and in this case also, what's the token values for each step in the process. You get those values by using the debugging techniques described in the ECA Guide.

Production build 0.71.5 2024