Open igorjacon opened 6 years ago
@craue
Hi I solved this by configuring the service like this :
app.form.registration:
class: AppBundle\Form\RegistrationFlow
parent: craue.form.flow
public: true
autowire: true
autoconfigure: false
Hello @igorjacon, @Andrufus is this quick fix still working with last version of symfony? I'm still struggling with the exact same error you had.
Thanks for your help!
@craue will this bundle be updated to work with last version of symfony (and the new DI system)? Thanks,
Gerfaut
Hi @Gerfaut I used this config with Symfony 3.4.3. I didn't test on any other version.
Hi @Gerfaut
It's working for me on Symfony 4. I created a new service config like so:
services:
App\Form\Vendor\RegistrationFlow\VendorRegistrationType:
parent: craue.form.flow
public: true
autowire: true
autoconfigure: false
@igorjacon that's weird, I tried this too on Symfony 4.1.5 and it was not working properly. I'll retry this evening :)
On what service file did you add that service config? I had to create a different service file. Hope that helps.
Hello @igorjacon, OK, I got it and you were right in your previous answer!
I was declaring my service like this:
app.form.RegistrationFlow:
class: App\Form\Vendor\RegistrationFlow\VendorRegistrationType
parent: craue.form.flow
public: true
autowire: true
autoconfigure: false
So with an alias... And this was not working.
But if I take your example:
services:
App\Form\Vendor\RegistrationFlow\VendorRegistrationType:
parent: craue.form.flow
public: true
autowire: true
autoconfigure: false
So without alias and declaring it directly with the class it works perfectly and I can then inject it in my Controller constructor or method.
/**
* @Route("/create")
*/
public function create(VendorRegistrationType $vendorRegistrationType)
{
....
}
And to answer to your last question, I was able to add this directly in the existing services.yaml.
Thanks a lot for your help and very quick answer !! 👍
Gerfaut
Awesome, I'm glad it works 👍
I faced the following issue when trying to use the parent: craue.form.flow
to define my flow service :
The service "\Our\Flow" cannot use the "parent" option in the same file where "_instanceof" configuration is defined as using both is not supported. Move your child definitions to a separate file.
We tried moving the service definition to another file, but it didn't work out at first (probably because we forgot clearing the cache at the time). So we used this solution instead :
services:
// our defaults config
_defaults:
autowire: true
autoconfigure: true
public: false
_instanceof:
// others custom definitions here
Craue\FormFlowBundle\Form\FormFlow:
calls:
- [setDataManager, ['@craue.form.flow.data_manager']]
- [setFormFactory, ['@form.factory']]
- [setRequestStack, ['@request_stack']]
- [setEventDispatcher, ['@?event_dispatcher']]
It would be nice if this was correctly set by the bundle using Symfony's autoconfigure/_instanceof features.
See #333.
I know this is a duplicate of issue 318 but I'm having the same problem and that issue is closed but no explanation given.
I have the same setup, can someone help?
Thanks