StateMachineEvent not getting entity

Created on 2 February 2025, 2 months ago

Problem/Motivation

When reacting to pre_transition or post_transition events, actions doesn't have the entity available to act on.

Steps to reproduce

1. Create flow with State Machine event
2. Try to show a message with entity values [entity:label]
3. Message empty, entity not available.

Proposed resolution

I've reviewed and compare this event code with other ECA events and may be we need to declare the function getData additionally to the actual buildEventData, in order to get entity available. I'm not totally sure the implementation Im attaching is fine but this works in my enviroment after a few tests.

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇦🇷Argentina dariogcode

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

Merge Requests

Comments & Activities

  • Issue created by @dariogcode
  • 🇩🇪Germany Istari

    Your approach mentioned here works for me as well :)

  • 🇩🇪Germany jurgenhaas Gottmadingen

    The entity is available as an event token, i.e. [event:entity:label] would work. But as a matter of convenience, we can also provide the entity token directly.

    @dariogcode as a tip for future contributions, it would be great to create an MR (not just the issue fork) and then set the issue to the status "Needs review". By then unassigning yourself from it, this indicates that the code suggestion should be looked at by somebody.

  • Merge request !2Issue #3503889 Event not getting entity. → (Merged) created by jurgenhaas
  • 🇩🇪Germany jurgenhaas Gottmadingen

    jurgenhaas changed the visibility of the branch 3503889-statemachineevent-not-getting to hidden.

  • 🇩🇪Germany jurgenhaas Gottmadingen

    I've created the MR and test were running. Just a couple of code style issues need attention.

  • 🇩🇪Germany Istari

    Fixed the code styling so pipelines will run and the merge request will be without any issues.
    For me to know (because I need the fix): will there be any release with this fix soon?
    Otherwise I would provide a patch to bridge the time until the next release.

  • 🇩🇪Germany jurgenhaas Gottmadingen

    This is looking good now, thanks @mysdiir.

    Regarding a patch, did you know that it is strongly recommended to download them locally and not use any patches from d.o? This is important because it is not guaranteed that patches will always be there. Especially with the forthcoming GitLab migration of issue, it may well be that patches are no longer available. Therefore, instead of creating a patch and uploading that here, you can download the MR-patch and have that locally. But that just as a sidenote.

    I'll tag a new release now.

    • jurgenhaas committed e987d60d on 2.0.x
      Issue #3503889: StateMachineEvent not getting entity
      
      
      (cherry picked...
  • 🇩🇪Germany Istari

    Yeah I know. I'll do this whenever I need patch. Not only like you described it, but also for reducing unnecessary traffic on d.o. when updating composer :)
    But thanks for the input :)
    I just thought you could place a patch file in this issue (like I've seen it in many other issues) so you wouldn't have any hurry with releasing a new version of the module.

  • 🇩🇪Germany jurgenhaas Gottmadingen

    I just thought you could place a patch file in this issue (like I've seen it in many other issues)

    Yeah, but that seduces other users to use the patch from d.o directly, it is not really great to see all these patches everywhere. If the MR is good for you, just click on the "Plain diff" link below the IS, next to the link to the MR. That downloads the patch for you, and you can use that locally. Any other user could later do the same thing.

  • 🇩🇪Germany Istari

    Ah okay now I understand :).
    Thank for that valuable input.

Production build 0.71.5 2024