add location form
This commit is contained in:
parent
d99ef31fef
commit
2e163d526c
38
src/Form/LocationFormType.php
Normal file
38
src/Form/LocationFormType.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use App\Entity\Location;
|
||||
use App\Entity\MemberCase;
|
||||
use App\Enums\State;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\EnumType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class LocationFormType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('name')
|
||||
->add('address')
|
||||
->add('city')
|
||||
->add('state', EnumType::class, [
|
||||
'class' => State::class
|
||||
])
|
||||
->add('zip')
|
||||
;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => Location::class,
|
||||
'csrf_protection' => true,
|
||||
'csrf_field_name' => '_token',
|
||||
'csrf_token_id' => 'location',
|
||||
]);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user