<?php
namespace App\Form\Backend\Shared;
use App\Entity\Address;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class AddressType extends AbstractType
{
/**
* @param FormBuilderInterface $builder
* @param array $options
*
* @return void
*/
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('company')
->add(
'street',
null,
[
'required' => true
]
)
->add(
'housenr',
null,
[
'required' => true
]
)
->add(
'zipcode',
null,
[
'required' => true
]
)
->add(
'city',
null,
[
'required' => true
]
)
->add('country');
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults(
[
'data_class' => Address::class,
]
);
}
}