src/Form/Type/PotentialCustomerCompanyContactType.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Form\Type;
  3. use App\Entity\Company;
  4. use App\Entity\PotentialCustomerCompanyContact;
  5. use Symfony\Component\Form\AbstractType;
  6. use Symfony\Component\Form\Extension\Core\Type\EmailType;
  7. use Symfony\Component\Form\Extension\Core\Type\TextType;
  8. use Symfony\Component\Form\FormBuilderInterface;
  9. use Symfony\Component\OptionsResolver\OptionsResolver;
  10. class PotentialCustomerCompanyContactType extends AbstractType
  11. {
  12.     /**
  13.      * @var Company
  14.      */
  15.     protected $company;
  16.     /**
  17.      * {@inheritDoc}
  18.      */
  19.     public function configureOptions(OptionsResolver $resolver)
  20.     {
  21.         $resolver->setDefaults(
  22.             [
  23.                 'data_class'         => PotentialCustomerCompanyContact::class,
  24.                 'translation_domain' => 'PotentialCustomerCompanyContact',
  25.                 'empty_data'         => new PotentialCustomerCompanyContact(),
  26.             ]
  27.         );
  28.     }
  29.     /**
  30.      * {@inheritDoc}
  31.      */
  32.     public function buildForm(FormBuilderInterface $builder, array $options)
  33.     {
  34.         $builder
  35.             ->add(
  36.                 'name',
  37.                 TextType::class,
  38.                 [
  39.                     'label' => false,
  40.                     'attr'  => [
  41.                         'placeholder' => 'property.name',
  42.                     ],
  43.                 ]
  44.             )
  45.             ->add(
  46.                 'role',
  47.                 TextType::class,
  48.                 [
  49.                     'label' => false,
  50.                     'attr'  => [
  51.                         'placeholder' => 'property.role',
  52.                     ],
  53.                 ]
  54.             )
  55.             ->add(
  56.                 'email',
  57.                 EmailType::class,
  58.                 [
  59.                     'label'    => false,
  60.                     'required' => false,
  61.                     'attr'  => [
  62.                         'placeholder' => 'property.email',
  63.                     ],
  64.                 ]
  65.             )
  66.             ->add(
  67.                 'phone',
  68.                 TextType::class,
  69.                 [
  70.                     'label'    => false,
  71.                     'required' => false,
  72.                     'attr'  => [
  73.                         'placeholder' => 'property.phone',
  74.                     ],
  75.                 ]
  76.             )
  77.         ;
  78.     }
  79. }