I want to override an FOS User action named confirmAction. Here below my action ↓
/**
* Receive the confirmation token from user email provider, login the user.
*
* @param Request $request
* @param string $token
*
* @return Response
*/
public function confirmAction(Request $request, $token)
{
$utilisateur = $this->getDoctrine()
->getRepository(Utilisateur::class)
->findOneByConfirmationToken($token);
$utilisateur->setMyAttribute(null);
$em = $this->getDoctrine()->getManager();
$em->persist($utilisateur);
$em->flush();
return parent::confirmAction($request, $token);}
If I dont overwrite the constructor I got the error that say the variables are not declared like $userManager, $eventDispatcher...
Type error: Argument 1 passed to FOS\UserBundle\Controller\RegistrationController::__construct() must implement interface Symfony\Component\EventDispatcher\EventDispatcherInterface, none given, called in /var/www/html/linguanomad/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php on line 195
If I override the constructor as : public function __construct(){}
I got the error : Call to a member function findUserByConfirmationToken() on null
Should I override the constructor ? How should I do that ?