<?php
namespace FMT\Application\FormType\Subscribers;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
class RegistrationStudentSubscriber implements EventSubscriberInterface
{
/**
* {@inheritDoc}
*/
public static function getSubscribedEvents()
{
return [
FormEvents::PRE_SET_DATA => 'preSetData'
];
}
/**
* @param FormEvent $event
* @return void
*/
public function preSetData(FormEvent $event)
{
$form = $event->getForm();
$form->get('profile')->remove('snapchatId');
$form->get('profile')->remove('facebookMessengerId');
$form->get('profile')->remove('otherEmail');
}
}