src/Form/CompanyType.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Form;
  3. use App\Entity\Company;
  4. use Symfony\Component\Form\AbstractType;
  5. use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
  6. use Symfony\Component\Form\Extension\Core\Type\FileType;
  7. use Symfony\Component\Form\FormBuilderInterface;
  8. use Symfony\Component\OptionsResolver\OptionsResolver;
  9. class CompanyType extends AbstractType
  10. {
  11.     public function buildForm(FormBuilderInterface $builder, array $options): void
  12.     {
  13.         $builder
  14.             ->add('Name')
  15.             ->add('website')
  16.             ->add('email')
  17.             ->add('phone')
  18.             ->add('brief')
  19.             ->add('location')
  20.             ->add('sales')
  21.             ->add('employees')
  22.             ->add('founded')
  23.             ->add('image'FileType::class, [
  24.                 'label' => false,
  25.                 'mapped' => false,
  26.                 'required' => false,
  27.             ])
  28.             ->add('industry'ChoiceType::class, [
  29.                 'choices' => [
  30.                     'Electronics and Electrical' => 'Electronics and Electrical',
  31.                     'Renewable Energy' => 'Renewable Energy',
  32.                     'Automotive and Transportation' => 'Automotive and Transportation',
  33.                     'Medical and Health Equipment' => 'Medical and Health Equipment',
  34.                     'Home Goods and Consumer Products' => 'Home Goods and Consumer Products',
  35.                     'Heavy Industry and Industrial Equipment' => 'Heavy Industry and Industrial Equipment',
  36.                     'Textiles, Apparel and Footwear' => 'Textiles, Apparel and Footwear',
  37.                     'Tools, Hardware and Metal Products' => 'Tools, Hardware and Metal Products',
  38.                     'Chemicals and Materials' => 'Chemicals and Materials',
  39.                     'Agriculture and Food Processing' => 'Agriculture and Food Processing',
  40.                     'Software-Integrated Manufacturing' => 'Software-Integrated Manufacturing',
  41.                 ],
  42.                 'placeholder' => '------------------',
  43.             ])  
  44.         ;
  45.     }
  46.     public function configureOptions(OptionsResolver $resolver): void
  47.     {
  48.         $resolver->setDefaults([
  49.             'data_class' => Company::class,
  50.         ]);
  51.     }
  52. }