-
|
So I have a REST application with a table with entries and each of them has a state. I want to use state machine to enforce proper state. Because the application can run as multiple processes, the only state I keep is in database. The question #508 provides answer very close to what I want. I especially love the one with domain model. My problem though is that I use Is it possible to handle async case somehow with domain model? If not, would it be considered to add that in the future? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Do you have any object in memory that act as the state holder? One way to implement is to have a domain object being used as a model. A State machine don't hold any state value, it depends on a model (if no model is provided, it creates a simple one internally). If you already have a domain model, you can either attach one state machine (maybe using as mixin, or pass the model instance when creating the state machine. |
Beta Was this translation helpful? Give feedback.
Do you have any object in memory that act as the state holder?
One way to implement is to have a domain object being used as a model. A State machine don't hold any state value, it depends on a model (if no model is provided, it creates a simple one internally).
If you already have a domain model, you can either attach one state machine (maybe using as mixin, or pass the model instance when creating the state machine.