B
B
BonBon Slick2018-09-27 14:36:41
symfony
BonBon Slick, 2018-09-27 14:36:41

The form is always empty, why?

$builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) {
            $data = $event->getData();
            dump($data);
        });
// or
        $data = $builder->getData();

Always empty after the form is submitted. Although it was filled before etogo, before rendering + data after the output is changed.
Why is that?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
Flying, 2018-09-27
@Flying

Obviously the answer lies in the very name of the event, it is called before the data enters the form. The documentation for this event explicitly states this.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question