<?php
namespace App\Form;
use App\Entity\User;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
class UserType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('nom', null, [
'label' => 'Name', // Use the translation key
])
->add('email', EmailType::class, [
'label' => 'Email',
'required' => true
])
->add('password')
->add('username', TextType::class, [
"attr" => [
"minlength" => 6,
"maxlength" => 10,
],
])
->add('country', ChoiceType::class, [
"label" => "Country",
'choices' => [
"Afghanistan" => "Afghanistan",
"Albania" => "Albania",
"Algeria" => "Algeria",
"Andorra" => "Andorra",
"Angola" => "Angola",
"Antigua And Barbuda" => "Antigua And Barbuda",
"Argentina" => "Argentina",
"Armenia" => "Armenia",
"Australia" => "Australia",
"Austria" => "Austria",
"Azerbaijan" => "Azerbaijan",
"Bahrain" => "Bahrain",
"Bangladesh" => "Bangladesh",
"Barbados" => "Barbados",
"Belarus" => "Belarus",
"Belgium" => "Belgium",
"Belize" => "Belize",
"Benin" => "Benin",
"Bhutan" => "Bhutan",
"Bolivia" => "Bolivia",
"Bonaire, Sint Eustatius and Saba" => "Bonaire, Sint Eustatius and Saba",
"Bosnia and Herzegovina" => "Bosnia and Herzegovina",
"Botswana" => "Botswana",
"Brazil" => "Brazil",
"Brunei" => "Brunei",
"Bulgaria" => "Bulgaria",
"Burkina Faso" => "Burkina Faso",
"Burundi" => "Burundi",
"Cambodia" => "Cambodia",
"Cameroon" => "Cameroon",
"Canada" => "Canada",
"Cape Verde" => "Cape Verde",
"Central African Republic" => "Central African Republic",
"Chad" => "Chad",
"Chile" => "Chile",
"China" => "China",
"Colombia" => "Colombia",
"Comoros" => "Comoros",
"Congo" => "Congo",
"Costa Rica" => "Costa Rica",
"Cote D'Ivoire (Ivory Coast)" => "Cote D'Ivoire (Ivory Coast)",
"Croatia" => "Croatia",
"Cuba" => "Cuba",
"Cyprus" => "Cyprus",
"Czech Republic" => "Czech Republic",
"Democratic Republic of the Congo" => "Democratic Republic of the Congo",
"Denmark" => "Denmark",
"Djibouti" => "Djibouti",
"Dominica" => "Dominica",
"Dominican Republic" => "Dominican Republic",
"East Timor" => "East Timor",
"Ecuador" => "Ecuador",
"Egypt" => "Egypt",
"El Salvador" => "El Salvador",
"Equatorial Guinea" => "Equatorial Guinea",
"Eritrea" => "Eritrea",
"Estonia" => "Estonia",
"Ethiopia" => "Ethiopia",
"Fiji Islands" => "Fiji Islands",
"Finland" => "Finland",
"France" => "France",
"Gabon" => "Gabon",
"Gambia The" => "Gambia The",
"Georgia" => "Georgia",
"Germany" => "Germany",
"Ghana" => "Ghana",
"Greece" => "Greece",
"Grenada" => "Grenada",
"Guatemala" => "Guatemala",
"Guinea" => "Guinea",
"Guinea-Bissau" => "Guinea-Bissau",
"Guyana" => "Guyana",
"Haiti" => "Haiti",
"Honduras" => "Honduras",
"Hungary" => "Hungary",
"Iceland" => "Iceland",
"India" => "India",
"Indonesia" => "Indonesia",
"Iran" => "Iran",
"Iraq" => "Iraq",
"Ireland" => "Ireland",
"Israel" => "Israel",
"Italy" => "Italy",
"Jamaica" => "Jamaica",
"Japan" => "Japan",
"Jordan" => "Jordan",
"Kazakhstan" => "Kazakhstan",
"Kenya" => "Kenya",
"Kiribati" => "Kiribati",
"Kuwait" => "Kuwait",
"Kyrgyzstan" => "Kyrgyzstan",
"Laos" => "Laos",
"Latvia" => "Latvia",
"Lebanon" => "Lebanon",
"Lesotho" => "Lesotho",
"Liberia" => "Liberia",
"Libya" => "Libya",
"Liechtenstein" => "Liechtenstein",
"Lithuania" => "Lithuania",
"Luxembourg" => "Luxembourg",
"Macedonia" => "Macedonia",
"Madagascar" => "Madagascar",
"Malawi" => "Malawi",
"Malaysia" => "Malaysia",
"Maldives" => "Maldives",
"Mali" => "Mali",
"Malta" => "Malta",
"Mauritania" => "Mauritania",
"Mauritius" => "Mauritius",
"Mexico" => "Mexico",
"Micronesia" => "Micronesia",
"Moldova" => "Moldova",
"Mongolia" => "Mongolia",
"Montenegro" => "Montenegro",
"Morocco" => "Morocco",
"Mozambique" => "Mozambique",
"Myanmar" => "Myanmar",
"Namibia" => "Namibia",
"Nauru" => "Nauru",
"Nepal" => "Nepal",
"Netherlands" => "Netherlands",
"New Zealand" => "New Zealand",
"Nicaragua" => "Nicaragua",
"Niger" => "Niger",
"Nigeria" => "Nigeria",
"North Korea" => "North Korea",
"Norway" => "Norway",
"Oman" => "Oman",
"Pakistan" => "Pakistan",
"Palau" => "Palau",
"Panama" => "Panama",
"Papua new Guinea" => "Papua new Guinea",
"Paraguay" => "Paraguay",
"Peru" => "Peru",
"Philippines" => "Philippines",
"Poland" => "Poland",
"Portugal" => "Portugal",
"Qatar" => "Qatar",
"Romania" => "Romania",
"Russia" => "Russia",
"Rwanda" => "Rwanda",
"Saint Kitts And Nevis" => "Saint Kitts And Nevis",
"Saint Lucia" => "Saint Lucia",
"Saint Vincent And The Grenadines" => "Saint Vincent And The Grenadines",
"Samoa" => "Samoa",
"San Marino" => "San Marino",
"Sao Tome and Principe" => "Sao Tome and Principe",
"Saudi Arabia" => "Saudi Arabia",
"Senegal" => "Senegal",
"Serbia" => "Serbia",
"Seychelles" => "Seychelles",
"Sierra Leone" => "Sierra Leone",
"Singapore" => "Singapore",
"Slovakia" => "Slovakia",
"Slovenia" => "Slovenia",
"Solomon Islands" => "Solomon Islands",
"Somalia" => "Somalia",
"South Africa" => "South Africa",
"South Korea" => "South Korea",
"South Sudan" => "South Sudan",
"Spain" => "Spain",
"Sri Lanka" => "Sri Lanka",
"Sudan" => "Sudan",
"Suriname" => "Suriname",
"Swaziland" => "Swaziland",
"Sweden" => "Sweden",
"Switzerland" => "Switzerland",
"Syria" => "Syria",
"Taiwan" => "Taiwan",
"Tajikistan" => "Tajikistan",
"Tanzania" => "Tanzania",
"Thailand" => "Thailand",
"The Bahamas" => "The Bahamas",
"Togo" => "Togo",
"Tonga" => "Tonga",
"Trinidad And Tobago" => "Trinidad And Tobago",
"Tunisia" => "Tunisia",
"Turkey" => "Turkey",
"Turkmenistan" => "Turkmenistan",
"Tuvalu" => "Tuvalu",
"Uganda" => "Uganda",
"Ukraine" => "Ukraine",
"United Arab Emirates" => "United Arab Emirates",
"United Kingdom" => "United Kingdom",
"United States" => "United States",
"Uruguay" => "Uruguay",
"Uzbekistan" => "Uzbekistan",
"Vanuatu" => "Vanuatu",
"Venezuela" => "Venezuela",
"Vietnam" => "Vietnam",
"Virgin Islands (US)" => "Virgin Islands (US)",
"Yemen" => "Yemen",
"Zambia" => "Zambia",
"Zimbabwe" => "Zimbabwe",
"Others" => "Others"
], 'placeholder' => '------------------',
])
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => User::class,
]);
}
}