<?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\DateType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class RegisterType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('email', TextType::class, [
'label' => false,
'attr' => [
'placeholder' => "enter email",
'class' => 'input'
]
])
->add('password', PasswordType::class, [
'label' => false,
'attr' => [
'class' => 'input'
]
])
->add('name', TextType::class, [
'label' => false,
'attr' => [
'class' => 'input'
]
])
->add('birthday', DateType::class, [
'label' => false,
'widget' => 'single_text',
'attr' => [
'type' => 'date',
]
])
->add('phone', IntegerType::class, [
'label' => false,
'attr' => [
'class' => 'input',
]
])
->add('state', TextType::class, [
'label' => false,
'attr' => [
'class' => 'input',
]
])
->add('country', TextType::class, [
'label' => false,
'attr' => [
'class' => 'input',
]
])
->add('postalCode', TextType::class, [
'label' => false,
'attr' => [
'class' => 'input',
]
])
->add('gender', ChoiceType::class, [
'choices' => [
'ذكر' => 'male',
'أنثى' => 'female',
],
'label' => false,
'attr' => [
'class' => 'input'
]
])
->add('address', TextType::class, [
'label' => false,
'attr' => [
'class' => 'input'
]
]);
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => User::class,
]);
}
}