You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description of the problem including expected versus actual behavior:
I'm trying to override loginAction, but it doesn't work, I think the documents are not very detailed So it must provide at least one exemple for override Controller, Template,etc ...
Steps to reproduce:
I know that the inheritance was deprecated but I have created a bundle in which I will override FOS User Bundle functionnalities, I called this Bundle src/MyVendor/MyVendorFOSUserBundle.
test autoload => OK.
2.I copied SecurityController.php from the vendor/ in my bundle MyVendorFOSUserBundle/Controller/ And I add the @route Decorator above the loginAction but I get an issue when submiting login form => Invalid CSRF token: by debuggin I fount that the $tokenManager doesn't be injected in the Controller so it's take null value: In this code I just added the @route decorator and extends BaseController to the Contoller copied.
The result Controller:
#src/MyVendor/MyVendorFOSUserBundle/Controller/SecurityController.php:
class SecurityController extends BaseController
{
private $tokenManager;
public function __construct(CsrfTokenManagerInterface $tokenManager = null)
{
$this->tokenManager = $tokenManager;
}
/**
* @param Request $request
* @return Response
* @Route("/login")
*/
public function loginAction(Request $request)
{ ... }
tried to add the attribute name in @route Decorator and I kept the same route name as it is in FOS User Bundle but in this case the Controller of FOS User bundle which is executed and my new Controller was ignored ( I test this by putting die('test') on Controller contructor)
The Question What is the solution to correctly override this action ?
The text was updated successfully, but these errors were encountered:
garalimedkarim
changed the title
Symfoyn 3.4 : FOS User Bundle : Override Controller Ask
Symfoyn 3.4 : FOS User Bundle : Override Controller
Apr 30, 2018
Symfony version:
Symfony FOSUserBundle versions:
Description of the problem including expected versus actual behavior:
I'm trying to override loginAction, but it doesn't work, I think the documents are not very detailed So it must provide at least one exemple for override Controller, Template,etc ...
Steps to reproduce:
test autoload => OK.
2.I copied SecurityController.php from the vendor/ in my bundle MyVendorFOSUserBundle/Controller/ And I add the @route Decorator above the loginAction but I get an issue when submiting login form => Invalid CSRF token: by debuggin I fount that the $tokenManager doesn't be injected in the Controller so it's take null value: In this code I just added the @route decorator and extends BaseController to the Contoller copied.
The result Controller:
The Question What is the solution to correctly override this action ?
The text was updated successfully, but these errors were encountered: