@@ -47,8 +47,8 @@ final class Funnel implements FunnelInterface
47
47
private FormFactoryInterface $ formFactory ;
48
48
private SuccessHandlerInterface $ successHandler ;
49
49
private SkipHandlerInterface $ skipHandler ;
50
-
51
50
private SessionInterface $ session ;
51
+ private bool $ isLiveEntity = false ;
52
52
53
53
public function __construct (FormFactoryInterface $ formFactory , RequestStack $ requestStack )
54
54
{
@@ -91,6 +91,13 @@ public function setSuccessHandler(SuccessHandlerInterface $successHandler): self
91
91
return $ this ;
92
92
}
93
93
94
+ public function isLiveEntity (bool $ preloaded ): self
95
+ {
96
+ $ this ->isLiveEntity = $ preloaded ;
97
+
98
+ return $ this ;
99
+ }
100
+
94
101
public function process (Request $ request )
95
102
{
96
103
if (!is_object ($ this ->entity )) {
@@ -102,7 +109,7 @@ public function process(Request $request)
102
109
103
110
$ funnelState = $ this ->getState ($ newState );
104
111
105
- $ entity = $ funnelState ->getEntity ();
112
+ $ entity = $ this -> isLiveEntity ? $ this -> entity : $ funnelState ->getEntity ();
106
113
107
114
if (null !== $ request ->get ('skip ' , null )) {
108
115
return $ this ->handleSkip ($ entity );
@@ -212,7 +219,7 @@ private function getState(bool $newState): FunnelState
212
219
private function saveState (FunnelState $ funnelState )
213
220
{
214
221
$ this ->getLogger ()->info ('Saving funnel state ' , ['entity ' => get_class ($ this ->entity )]);
215
- $ this ->session ->set (get_class ( $ this ->entity ).'_funnel ' , $ funnelState );
222
+ $ this ->session ->set ($ this ->entity -> getId ( ).'_funnel ' , $ funnelState );
216
223
}
217
224
218
225
private function getEntityName (): string
0 commit comments