src/FormSubscriber/WorkSheet/AttachmentWorkSheetFormSubscriber.php line 35

Open in your IDE?
  1. <?php
  2. /*
  3.  * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
  4.  * Click nbfs://nbhost/SystemFileSystem/Templates/Scripting/PHPClass.php to edit this template
  5.  */
  6. namespace App\FormSubscriber\WorkSheet;
  7. use App\Entity\WorkSheetAttachment;
  8. use Symfony\Component\Form\FormEvent;
  9. use Symfony\Component\Form\FormEvents;
  10. use Symfony\Component\Form\Extension\Core\Type\TextType;
  11. /**
  12.  * Description of AttachmentWorkSheetFormSubscriber
  13.  *
  14.  * @author programmer
  15.  */
  16. class AttachmentWorkSheetFormSubscriber implements WorkSheetFormSubscriberInterface 
  17. {
  18.     
  19.     public function isSupported(string $className): bool 
  20.     {
  21.         return WorkSheetAttachment::class === $className;
  22.     }
  23.     public static function getSubscribedEvents() 
  24.     {
  25.         return [
  26.             FormEvents::POST_SET_DATA => 'postSetData'
  27.         ];
  28.     }
  29.     
  30.     public function postSetData(FormEvent $event):void
  31.     {
  32.         $event->getForm()
  33.                 ->add('name'TextType::class, [
  34.                     "label" => "name"
  35.                 ]);
  36.     }
  37. }