I have the following method in a controller in Symfony 7:
#[Route('/settings/email', name: 'settings.email', methods: ['PUT'])]
public function updateEmail(Request $request): Response
{
$data = $request->toArray();
dd($data);
}
I would like to get the email value from the body, however, when I use $request->toArray()
it causes a redirect to the current page (for example: I am at /settings and it redirects to /settings, the dd isn’t triggered).
How to solve that?
Edit:
The method is called from a form: