-
To ensure compatibility with the latest versions of Symfony, the request scope has been removed from all service definitions. You in turn also have to remove the scope from your flows and connected form types.
before:
<service id="myCompany.form.flow.createTopic" class="MyCompany\MyBundle\Form\CreateTopicFlow" parent="craue.form.flow" scope="request"> </service>
after:
<service id="myCompany.form.flow.createTopic" class="MyCompany\MyBundle\Form\CreateTopicFlow" parent="craue.form.flow"> </service>
-
The step config option to specify the form type for each step within the
loadStepsConfig
method has been renamed fromtype
toform_type
. This was done for the sake of consistency with the newly added optionform_options
. The old optiontype
is still available, but deprecated.before:
protected function loadStepsConfig() { return array( array( 'type' => $this->formType, ), // ... ); }
after:
protected function loadStepsConfig() { return array( array( 'form_type' => $this->formType, ), // ... ); }
-
This version adds support for concurrent instances of the same flow, which required a change in the handling of flows.
-
When performing a GET request without any additional parameters to run a flow with dynamic step navigation enabled, it has just been reused as there could only be one instance using the default session storage. So previously, the data of all steps would still be available. Now, a new flow instance will be started. Thus, if you want to provide a custom link to the same flow instance, (beside the optional step number) you now need to add the instance id as parameter
instance
(per default).before:
<a href="{{ path('createTopic', {'step': 2}) }}">continue creating a topic</a>
after:
<a href="{{ path('createTopic', {'instance': flow.getInstanceId(), 'step': 2}) }}">continue creating a topic</a>
-
For the same reason, it's no longer necessary to use a dedicated action to reset a flow in order to start it with clean data.
before:
/** * @Route("/create-topic/start/", name="createTopic_start") */ public function createTopicStartAction() { $flow = $this->get('form.flow.createTopic'); $flow->reset(); return $this->redirect($this->generateUrl('createTopic')); }
<a href="{{ path('createTopic_start') }}">create a topic</a>
after:
<a href="{{ path('createTopic') }}">create a topic</a>
-
To remove saved step data from the session when finishing the flow you should call
$flow->reset()
at the end of the action.before:
public function createTopicAction() { // ... // flow finished // persist data to the DB or whatever... // redirect when done... }
after:
public function createTopicAction() { // ... // flow finished // persist data to the DB or whatever... $flow->reset(); // redirect when done... }
-
Options cannot be passed to step forms using
createForm
anymore. You can now usesetGenericFormOptions
for that.before:
$flow->bind($formData); $form = $flow->createForm(array('action' => 'targetUrl'));
after:
$flow->setGenericFormOptions(array('action' => 'targetUrl')); $flow->bind($formData); $form = $flow->createForm();
-
Some methods have been renamed.
PostBindRequestEvent
:getStep
togetStepNumber
PostBindSavedDataEvent
:getStep
togetStepNumber
-
Some properties have been renamed.
PostBindRequestEvent
:step
tostepNumber
PostBindSavedDataEvent
:step
tostepNumber
-
A default implementation for method
getName
has been added. If you just let it return the class name with the first letter lower-cased and without the "Flow" suffix, you can remove it from your flow since the default implementation will return the same value.before:
class CreateVehicleFlow extends FormFlow { public function getName() { return 'createVehicle'; } // ... }
after:
class CreateVehicleFlow extends FormFlow { // ... }
-
The signature of method
setRequest
has changed to accept aRequestStack
instance.public function setRequest(Request $request = null)
topublic function setRequestStack(RequestStack $requestStack)
-
Some methods have been removed.
setStepDataKey
/getStepDataKey
setStorage
/getStorage
(callgetDataManager()->getStorage()
instead or adapt your code to usesetDataManager
/getDataManager
)
-
Some methods have been renamed.
setDynamicStepNavigationParameter
tosetDynamicStepNavigationStepParameter
getDynamicStepNavigationParameter
togetDynamicStepNavigationStepParameter
-
A property has been removed.
storage
(call$this->dataManager->getStorage()
instead)
-
A property has been renamed.
dynamicStepNavigationParameter
todynamicStepNavigationStepParameter
-
Some methods have been renamed.
setType
tosetFormType
getType
togetFormType
-
A property has been renamed.
type
toformType
- The signature of method
remove
inStorageInterface
has changed to not return the removed value anymore.
-
The Twig filters
craue_addDynamicStepNavigationParameter
andcraue_removeDynamicStepNavigationParameter
have been renamed tocraue_addDynamicStepNavigationParameters
andcraue_removeDynamicStepNavigationParameters
, i.e. pluralized, since they now handle more than one parameter. Filters with the old names still exist, but are deprecated. -
The template
CraueFormFlowBundle:FormFlow:stepField.html.twig
(deprecated in 2.1.0) has been removed.