Given the following scenario:
controller@method_a
spawns a process (Symfony Process object) asynchronously, controller@method_b
needs to interact with the process
How would you implement sharing the Process object?
Things I've went over:
- controller properties don't persist, as with each request the controller gets reinstantiated
- Session can't store complex objects, and serialization would take the soul of it
- database can't store complex objects either
edit:
To the serialization issue:
$process = new Process("dir");
$process->start();
$x = serialize($process);
dd($x);
If I remove the $process->start()
, it does not fire Serialization of 'Closure' is not allowed
. But I can't do anything with a handle for a process that's not started.