Нужно выполнить что-то по типу такого?
public function registration()
{
$user = new User();
$form = $this->createForm(RegistrationFormType::class, $user);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
// encode the plain password
$user->setPassword(
$passwordEncoder->encodePassword(
$user,
$form->get('plainPassword')->getData()
)
);
$userType = $form->get('type')->getData();
var_dump($userType); exit;
$entityManager = $this->getDoctrine()->getManager();
$entityManager->persist($user);
$entityManager->flush();
// // generate a signed url and email it to the user
// $this->emailVerifier->sendEmailConfirmation('app_verify_email', $user,
// (new TemplatedEmail())
// ->from(new Address('andrii.kozar@dev.pro', 'Andrii'))
// ->to($user->getEmail())
// ->subject('Please Confirm your Email')
// ->htmlTemplate('registration/confirmation_email.html.twig')
// );
// do anything else you need here, like send an email
$formView = $form->createView();
return $guardHandler->authenticateUserAndHandleSuccess(
$user,
$request,
$authenticator,
'main' // firewall name in security.yaml
);
}
}