craue / CraueFormFlowBundle

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

Symfony 4.1 #326

Closed igorjacon closed 5 years ago

igorjacon commented 6 years ago

Is this bundle compatible with Symfony4.1? I'm having an issue using this bundle with a project on Symfony4.1. Here is my service declaration:

services:
    App\Form\ProjectManager\FormFlow\CreateProjectFlowType:
        parent: craue.form.flow
        public: true
        autowire: true
        autoconfigure: false

My form extends FormFlow, but when I call the bind method on my form flow $flow->bind($project); I get the following error:

Call to a member function getCurrentRequest() on null

Can someone help? Thanks

ghost commented 6 years ago

I don't know if this will help you but I got it working by manually wiring the service in service.yaml as:

services: create.project.flow.type: class: App\Form\ProjectManager\FormFlow\CreateProjectFlowType public: true autowire: false autoconfigure: false parent: craue.form.flow Where the id was one chosen at will and the class location was that of the flow class that extends FormFlow.

And in my controller I did:

$flow = $this->get('create.project.flow.type); //Using the service id $flow->bind($project);

And it worked, beware of this module compatibility with Symfony 4.1 as other issues also come up depending on what are you trying to work on.

igorjacon commented 6 years ago

Thanks, that worked for me 👍

mikey242 commented 5 years ago

I don't know if this will help you but I got it working by manually wiring the service in service.yaml as:

services: create.project.flow.type: class: App\Form\ProjectManager\FormFlow\CreateProjectFlowType public: true autowire: false autoconfigure: false parent: craue.form.flow Where the id was one chosen at will and the class location was that of the flow class that extends FormFlow.

And in my controller I did:

$flow = $this->get('create.project.flow.type); //Using the service id $flow->bind($project);

And it worked, beware of this module compatibility with Symfony 4.1 as other issues also come up depending on what are you trying to work on.

Thanks, this helped me out too.

latenzio commented 5 years ago

ich think this is also a good solution:

services:
    _instanceof:
        Craue\FormFlowBundle\Form\FormFlow:
            calls:
                -
                    method: setDataManager
                    arguments: [ '@craue.form.flow.data_manager' ]
                -
                    method: setFormFactory
                    arguments: [ '@form.factory' ]
                -
                    method: setRequestStack
                    arguments: [ '@request_stack' ]
                -
                    method: setEventDispatcher
                    arguments: [ '@event_dispatcher' ]
craue commented 5 years ago

The latest release (3.1.0) is now fully tested with Symfony 4. Support for autoconfiguration could still be added...

craue commented 5 years ago

Guys, take a look at #333 please.