-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[workflow component] [RFC] Store a history of marking states in a field of the entity #28253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Would like a little help with what tests to write! |
Hello, (I'm really sorry for this huge delay) Thanks for your proposal and thanks for your first contribution 🎉 👏 I think we could take another approach thanks to this PR: #29146
While your idea is really interesting, I think your PR is too opinionated to fit the Core. More over your initial issue could be solved with few lines of code in your application. Instead I would suggest to open a PR in the documentation repository to explain this. What do you think ? |
I'm closing this issue. See #28266 (comment) for more details. |
…ixx) This PR was merged into the 4.3-dev branch. Discussion ---------- [Workflow] Added a context to `Workflow::apply()` | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #27925 (maybe #28253 and #28266) | License | MIT | Doc PR | Commits ------- 7d5b7a3 [Workflow] Added a context to `Workflow::apply()`
Description
I have a few workflows where I need to keep a log of the workflow places the entity has been through also including a timestamp and optional 'memo' - a short text detailing the state change. This is for three reasons;
to_dispatch
place for a while and are now overdue the three-day dispatch time window etc).config
I have come upon this solution for the workflow definition by allowing an additional config inside the
workflow.yaml
file:This additional configuration inside the workflow will essentially help set up a listener that stores a history of states for that entity inside the
trail_property
field which listens for the workflow'sentered
event. An optionalmemo_property
allows the user to store a brief description of the state change if required (e.g. payment verified by daniel, state automatically changed, admin changed state etc)entity
The entity will be set up like this (with getters / setters omitted):
output
Upon a state change, the state history is populated with an assoc array that contains the state the entity is changed to, including a timestamp, the froms and tos, the name of the transition used, and the value of the optional memo field if not null. This array is appended to the existing array value, and is keyed by workflow name allowing histories of multiple workflow states to be stored if necessary.
A
dd
of the state history field after a few state changes:I'd like to ask for comments on:
The text was updated successfully, but these errors were encountered: