src/FMT/Application/FormType/Subscribers/UserAvatarSubscriber.php line 28

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. /**
  7.  * Class UserAvatarSubscriber
  8.  * @package FMT\Application\FormType\Subscribers
  9.  */
  10. class UserAvatarSubscriber implements EventSubscriberInterface
  11. {
  12.     /**
  13.      * {@inheritdoc}
  14.      */
  15.     public static function getSubscribedEvents()
  16.     {
  17.         return [
  18.             FormEvents::PRE_SET_DATA => 'preSetData',
  19.         ];
  20.     }
  21.     /**
  22.      * @param FormEvent $event
  23.      */
  24.     public function preSetData(FormEvent $event)
  25.     {
  26.         $form $event->getForm();
  27.         $form->get('avatar')->remove('comment');
  28.     }
  29. }