src/FormSubscriber/WorkSheet/KlasifikasiWorkSheetFormSubscriber.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\WorksheetKlasifikasi;
  8. use Symfony\Component\Form\FormEvent;
  9. use Symfony\Component\Form\FormEvents;
  10. use Symfony\Bridge\Doctrine\Form\Type\EntityType;
  11. /**
  12.  * Description of KlasifikasiWorkSheetFormSubscriber
  13.  *
  14.  * @author programmer
  15.  */
  16. class KlasifikasiWorkSheetFormSubscriber implements WorkSheetFormSubscriberInterface
  17. {
  18.     //put your code here
  19.     public function isSupported(string $className): bool 
  20.     {
  21.         return WorksheetKlasifikasi::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('klasifikasi'EntityType::class, [
  34.                     "label" => "klasifikasi",
  35.                     "class" => \App\Entity\Klasifikasi::class
  36.                 ]);
  37.     }
  38. }