craue / CraueFormFlowBundle

Multi-step forms for your Symfony project.
MIT License
736 stars 118 forks source link

Call to a member function getCurrentRequest() on null #318

Closed kironet closed 6 years ago

kironet commented 6 years ago

Hey,

I have a problem with this bundle and new symfony 4. Here is my code:

    public function index(CheckoutFlow $flow, $id = null): Response
    {

        .....

        $flow->bind($order);

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

            if ($flow->nextStep()) {
                // form for the next step
                $form = $flow->createForm();
            } else {
                // flow finished
                $em->persist($order);
                $em->flush();

                $response = ...

                return $response;
            }
        }

        return $this->render('shop/checkout/index.html.twig', [
            'form' => $form->createView(),
            'flow' => $flow,
        ]);

    }
services:
    App\Form\Checkout\CheckoutFlow:
        parent: craue.form.flow

And I'm getting this error:

Call to a member function getCurrentRequest() on null

Am I doing something wrong?

igorjacon commented 6 years ago

Any news on this @kironet ? I'm having the same problem.