I want to use the resetViewTransformers()-function on two of my Form fields, but the thing is i am using an EventListener for my builder as you can see here:
$builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) use ($formFactory, $locale) {
/** @var PollResult $data */
$data = $event->getData();
$form = $event->getForm();
$fieldOptions = [];
$fieldOptions['required'] = false;
$form->add($formFactory->createNamed('value', 'choice', null, $fieldOptions));
}
now i'd like to call $builder->get('value')->resetViewTransformers(); but when i do that outside the eventi get the error The child with the name "value" does not exist. and inside the variable $builder is unknown.
How can i do that?