src/FMT/Application/FormType/Subscribers/RegistrationStudentSubscriber.php line 25

Open in your IDE?
  1. <?php
  2. namespace FMT\Application\FormType\Subscribers;
  3. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  4. use Symfony\Component\Form\FormEvent;
  5. use Symfony\Component\Form\FormEvents;
  6. class RegistrationStudentSubscriber implements EventSubscriberInterface
  7. {
  8.     /**
  9.      * {@inheritDoc}
  10.      */
  11.     public static function getSubscribedEvents()
  12.     {
  13.         return [
  14.             FormEvents::PRE_SET_DATA => 'preSetData'
  15.         ];
  16.     }
  17.     /**
  18.      * @param FormEvent $event
  19.      * @return void
  20.      */
  21.     public function preSetData(FormEvent $event)
  22.     {
  23.         $form $event->getForm();
  24.         $form->get('profile')->remove('snapchatId');
  25.         $form->get('profile')->remove('facebookMessengerId');
  26.         $form->get('profile')->remove('otherEmail');
  27.     }
  28. }