Created
May 24, 2016 12:30
-
-
Save mhlavac/adafc2ce5fd5fedcea77ffbe79f30430 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class UserType extends \Symfony\Component\Form\AbstractType | |
{ | |
public function buildForm(\Symfony\Component\Form\FormBuilderInterface $builder, array $options) | |
{ | |
$builder->add('name', CompoundType::class, [ | |
'inherit_data' => true, | |
]); | |
$builder->addEventListener(\Symfony\Component\Form\FormEvents::POST_SET_DATA, function (\Symfony\Component\Form\FormEvent $event) { | |
$child = $event->getForm()->get('name'); | |
$child->getConfig()->getEventDispatcher()->dispatch(FormEvents::POST_SET_DATA, new FormEvent($child, $event->getData())); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment