src/Form/Type/PotentialCustomerCompanyType.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Form\Type;
  3. use App\Entity\PotentialCustomerCompany;
  4. use Symfony\Component\Form\AbstractType;
  5. use Symfony\Component\Form\Extension\Core\Type\CollectionType;
  6. use Symfony\Component\Form\Extension\Core\Type\TextType;
  7. use Symfony\Component\Form\Extension\Core\Type\TextareaType;
  8. use Symfony\Component\Form\FormBuilderInterface;
  9. use Symfony\Component\OptionsResolver\OptionsResolver;
  10. class PotentialCustomerCompanyType extends AbstractType
  11. {
  12.     /**
  13.      * {@inheritDoc}
  14.      */
  15.     public function configureOptions(OptionsResolver $resolver)
  16.     {
  17.         $resolver->setDefaults(
  18.             [
  19.                 'data_class'         => PotentialCustomerCompany::class,
  20.                 'translation_domain' => 'PotentialCustomerCompany',
  21.             ]
  22.         );
  23.     }
  24.     /**
  25.      * {@inheritDoc}
  26.      */
  27.     public function buildForm(FormBuilderInterface $builder, array $options)
  28.     {
  29.         $builder
  30.             ->add(
  31.                 'name',
  32.                 TextType::class,
  33.                 [
  34.                     'label' => 'property.name',
  35.                 ]
  36.             )
  37.             ->add(
  38.                 'contacts',
  39.                 CollectionType::class,
  40.                 [
  41.                     'label'         => 'property.contacts',
  42.                     'required'      => false,
  43.                     'by_reference'  => false,
  44.                     'allow_add'     => true,
  45.                     'allow_delete'  => true,
  46.                     'entry_type'    => PotentialCustomerCompanyContactType::class,
  47.                     'entry_options' => [
  48.                         'label' => false,
  49.                     ]
  50.                 ]
  51.             )
  52.             ->add(
  53.                 'notes',
  54.                 TextareaType::class,
  55.                 [
  56.                     'label'    => 'property.notes',
  57.                     'required' => false,
  58.                 ]
  59.             )
  60.         ;
  61.     }
  62. }