<?php
namespace App\Form\Type;
use App\Entity\PotentialCustomerCompany;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class PotentialCustomerCompanyType extends AbstractType
{
/**
* {@inheritDoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(
[
'data_class' => PotentialCustomerCompany::class,
'translation_domain' => 'PotentialCustomerCompany',
]
);
}
/**
* {@inheritDoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add(
'name',
TextType::class,
[
'label' => 'property.name',
]
)
->add(
'contacts',
CollectionType::class,
[
'label' => 'property.contacts',
'required' => false,
'by_reference' => false,
'allow_add' => true,
'allow_delete' => true,
'entry_type' => PotentialCustomerCompanyContactType::class,
'entry_options' => [
'label' => false,
]
]
)
->add(
'notes',
TextareaType::class,
[
'label' => 'property.notes',
'required' => false,
]
)
;
}
}