Open SirWaddles opened 7 years ago
Serialized objects have often been broken at PHP level. This would be a time to remove all uses of \Serializable
in Workflow
objects including StateMachine
objects. If so, our SerializableInterface
will be introduced instead. Workflower or PHPMentorsWorkflowerBundle will be able to provide a JSON serializer (for example, by using Serializer) as the default serializer. What do you think?
I'm in the middle of trying to get something to work, this commit creates a json string which might sort of kind of work.
Still working on it, haha. So far, I've only looked at the serialization.
The unserializer actually gets pretty close. This was my attempt.
It actually looks pretty good. The dates are obviously wrong, and the Stagehand stuff is just a massive string, but everything looks in-tact.
I was wondering if there was a way to implement something to replace PHP's
\Serializable
interface and use that on all of the data structures. With aSerializer
interface, so that behaviour can be attached to actually recreating the entities themselves.Main reason I'm after this is because I have managed Doctrine entities everywhere, and it would be useful to keep them around instead of a shallow copy of them. With an unserializer implementation, I could look for the type and just keep the id and class in the serialized string.
This would break a few things, one major drawback I can imagine is that whenever you serialize/unserialize a workflow, you would need to specify the serializer implementation so the class can trickle down and be available throughout the tree. I wouldn't really want this to be globally available or kept in a registry anywhere because, for me anyway, it would need to be a Symfony service entry.
Also, early on, I wanted to push some data to the frontend React app, so a json version of the tree would be helpful as well.
I intend to work on this, but I was wondering if anyone had any alternative ideas/solutions or different models for the concept.