eca_render: Action "Render: Unserialize" does not work for "_eca_token" format

Created on 9 April 2025, 14 days ago

Problem/Motivation

When the "Defined by token" option is selected for the "Format" configuration in the "Render: Unserialize" action, an exception is thrown during execution:

Failed execution of Deserialize XML (Activity_14qzdaa) from ECA test (process_dwxhjtz) for event eca_base.custom: No decoder found for format "_eca_token"..\n\n#0 /Users/starlight/Sites/commerce-test/vendor/symfony/serializer/Encoder/ChainDecoder.php(42): Symfony\Component\Serializer\Encoder\ChainDecoder->getDecoder('_eca_token', Array)
#1 /Users/starlight/Sites/commerce-test/vendor/symfony/serializer/Serializer.php(421): Symfony\Component\Serializer\Encoder\ChainDecoder->decode('<xml...', '_eca_token', Array)
#2 /Users/starlight/Sites/commerce-test/web/modules/contrib/eca/modules/render/src/Plugin/Action/Unserialize.php(78): Symfony\Component\Serializer\Serializer->decode('<xml...', '_eca_token')
#3 /Users/starlight/Sites/commerce-test/web/modules/contrib/eca/modules/render/src/Plugin/Action/RenderElementActionBase.php(37): Drupal\eca_render\Plugin\Action\Unserialize->doBuild(Array)
#4 /Users/starlight/Sites/commerce-test/web/modules/contrib/eca/src/Entity/Objects/EcaAction.php(106): Drupal\eca_render\Plugin\Action\RenderElementActionBase->execute(NULL)

Cause

The method \Drupal\eca_render\Plugin\Action\Unserialize::doBuild() does not replace the token value for the format field.

Steps to reproduce

  1. Create an ECA flow
  2. Add an action to define token value eca_render_unserialize:serialization_type
  3. Add "Render: Unserialize" action with the "Format" option set to "Defined by token"
  4. Trigger the ECA event

Proposed resolution

Copy the following line from the parent class method \Drupal\eca_render\Plugin\Action\Serialize::doBuild():

if ($format === '_eca_token') {
  $format = $this->getTokenValue('format', 'json');
}

Remaining tasks

User interface changes

None.

API changes

None.

Data model changes

None.

🐛 Bug report
Status

Active

Version

3.0

Component

Code

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024