<?php
namespace App\Form;
use App\Entity\User;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Intl\Countries;
use Symfony\Component\OptionsResolver\OptionsResolver;
class RegistrationFormType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$countries = Countries::getNames();
$builder
->add('email', EmailType::class, [
'label' => 'Email Address',
'attr' => [
'class' => 'small mb-1',
],
])
->add('firstName')
->add('lastName')
->add('institutionName')
->add('mainPhoneNumber')
->add('mobilePhoneNumber')
->add('referralAgent')
->add('invitationCode')
->add('notes')
->add('sector', ChoiceType::class, [
'label' => 'Sector',
'placeholder' => 'Select your sector',
'choices' => [
'Government' => 'Government',
'Local Authority' => 'Local_Authority',
'Government Agency' => 'Government_Agency',
'Bank' => 'Bank',
'Listed public company (PLC)' => 'PLC',
'Regulated Fund' => 'Regulated_Fund',
'Unregulated Fund' => 'Unregulated_Fund',
'Fiduciary CSP' => 'Fiduciary_CSP',
'Charity' => 'Charity',
'Family Office' => 'Family_Office',
'Other - non-financial institution' => 'Other_non-financial_institution',
'Other - financial institution' => 'Other_financial_institution',
'Other' => 'Other',
],
])
->add('country', ChoiceType::class, [
'choices' => array_flip($countries),
'label' => 'Country',
'placeholder' => 'Select your country',
'preferred_choices' => ['GB', 'US'],
])
->add('password', PasswordType::class)
->add('confirmPassword', PasswordType::class, [
'attr' => [
'label' => 'Confirm Password',
'class' => 'small mb-1',
],
])
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => User::class,
]);
}
}