I'm trying to override the registration controller of my FOSUserBundle. I've followed the steps on https://symfony.com/doc/3.4/bundles/inheritance.html But I get the following error:
Cannot autowire service "AppBundle\Controller\RegistrationController": argument "$formFactory" of method "FOS\UserBundle\Controller\RegistrationController::__construct()" references interface "FOS\UserBundle\Form\Factory\FactoryInterface" but no such service exists. You should maybe alias this interface to one of these existing services: "fos_user.profile.form.factory", "fos_user.registration.form.factory", "fos_user.change_password.form.factory", "fos_user.resetting.form.factory".
My RegistrationController.php :
// src/UserBundle/Controller/RegistrationController.php
namespace AppBundle\Controller;
use FOS\UserBundle\Controller\RegistrationController as BaseController;
use Symfony\Component\HttpFoundation\Request;
class RegistrationController extends BaseController
{
public function registerAction(Request $request)
{
$response = parent::registerAction($request);
// ... do custom stuff
return $response;
}
}
My AppBundle.php
<?php
namespace AppBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class AppBundle extends Bundle
{
public function getParent()
{
return 'FOSUserBundle';
}
}
If more information is needed tell me so I can update this question.