<?php
namespace App\Form\Type;
use App\Document\User;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\CallbackTransformer;
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\Extension\Core\Type\RepeatedType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class UserType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('username', TextType::class, [
'label' => false,
'attr' => [
'class' => 'uk-input',
'placeholder' => 'Название компании',
]
])
->add('email', EmailType::class, [
'label' => false,
'attr' => [
'class' => 'uk-input',
'placeholder' => 'Email компании',
]
])
->add('inn', IntegerType::class, [
'label' => false,
'attr' => [
'class' => 'uk-input',
'placeholder' => 'ИНН компании',
]
])
->add('phone', TextType::class, [
'label' => false,
'attr' => [
'class' => 'uk-input',
'placeholder' => 'Телефон ответственного',
]
])
->add('quality_control_phone', TextType::class, [
'label' => false,
'attr' => [
'class' => 'uk-input',
'placeholder' => 'Телефон службы контроля качества',
]
])
->add('name', TextType::class, [
'label' => false,
'attr' => [
'class' => 'uk-input',
'placeholder' => 'ФИО ответственного',
]
])
->add(
'password',
RepeatedType::class,
[
'label' => false,
'type' => PasswordType::class,
'first_options' => [
'label' => false,
'attr' => ['class' => 'uk-input', 'placeholder' => 'Пароль']
],
'second_options' => [
'label' => false,
'attr' => ['class' => 'uk-input', 'placeholder' => 'Повторите пароль']
],
]
);
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => User::class,
]);
}
}