Export/Restore
The ControllerState
class can be used to store the current state of a controller.
It is serializable via the standard php function to allow it to be stashed somewhere.
An instance should be created from the Controller
object:
$state = $controller->exportState();
If you intend to export the state and stop playback,
then to avoid a gap between when the state is captured and playback is stopped you can have the exportState()
method stop playback:
# Export state and pause the controller
$state = $controller->exportState(true);
After exporting the state, you can apply it to any Controller
instance like so:
$controller->restoreState($state);