Cannot autowire service FOSUserBundle, Symfony 3.4
I installed and configured a fresh copy of Symfony 3.4 along with the latest FOSUserBundle 2.1
Since bundle inheritance is going away, just adjust the register route to point to your controller:
# config/routes.yamlfos_user: resource: "@FOSUserBundle/Resources/config/routing/all.xml"fos_user_registration_register: path: /register controller: AppBundle\Controller\RegistrationController::registerAction
And then inject the form factory into your controller:
# app/services.yaml, keep all the standard defaults aboveAppBundle\Controller\RegistrationController: arguments: $formFactory: '@fos_user.registration.form.factory'
And you should be good to go.
The only remaining question is why you would want to do this in the first place? You would basically need to copy/paste the entire registerAction from your base class. Most of the time you would want to create an FOS event subscriber and listen for REGISTRATION_INITIALIZE, REGISTRATION_SUCCESS,REGISTRATION_COMPLETED or REGISTRATION_FAILURE events.
I know for sure, that this works for Symfony 3.2.3This is only for symfony version <= 3. Because bundle inheritence is depraceted and will be disabled in 4. Change the version of FOSUserBundle in the composer.json to
"friendsofsymfony/user-bundle": "2.0.2"
and run command to update it
composer update