How to process FormFlow in Symfony?

  craueformflow, formflow, forms, php, symfony

I have this code in RegistrationController:

$formData = new User(); // Your form data class. Has to be an object, won't work properly with an array.

        $flow = $registrationFormFlow; // must match the flow's service id

        // form of the current step
        $form = $flow->createForm();
        if ($flow->isValid($form)) {

            if ($flow->nextStep()) {
                // form for the next step
                $form = $flow->createForm();
            } else {
                // flow finished
                $em = $this->getDoctrine()->getManager();

                $flow->reset(); // remove step data from the session

                return $this->redirect($this->generateUrl('home')); // redirect when done
        return $this->render('registration/register.html.twig', [
            'form' => $form->createView(),
            'flow' => $flow,

I’d like to know how can I encode a password that is passed in the first step of the flow? Before I started to use craue/CraueFormFlowBundle it looked like this:

 $user = new User();
        $form = $this->createForm(RegistrationFormType::class, $user);

        if ($form->isSubmitted() && $form->isValid()) {
            // encode the plain password

            $entityManager = $this->getDoctrine()->getManager();

            // Do anything else you need here, like send an email

            return $guardHandler->authenticateUserAndHandleSuccess(
                'main' // firewall name in security.yaml

        return $this->render('registration/register.html.twig', [
            'registrationForm' => $form->createView(),

Thanks for help and have a nice day.

Source: Symfony Questions