Examples with multiple models ie from 1:1 to x:1 on Order and OrderControl
Great example on Order and OrderControl. https://python-statemachine.readthedocs.io/en/latest/auto_examples/order_control_rich_model_machine.html
Would find it helpful to see how python-statemachine supports users with 2+ orders. ie does it have to be 1:1 Order & OrderControl or are there patterns for x:1 where there are many models and a single state machine controller that can work with and advance the state on multiple models.
I imagine many run into this and would be great to see a best practices example!
Thanks!
Hi @patrickwolf, how are you?
Could you elaborate a bit more on your use case? In this context, I’m considering changing the Order model to something like an OrderCollection model, which would encapsulate the complexity of managing multiple Order instances within the OrderControl machine. The OrderCollection could have its own set of validations—for example, allowing only orders in the same state—and it would propagate state changes to all internal order instances when a new state is entered.
That said, I’m just exploring possibilities. With a concrete example, we could dive deeper.