buildPreliminaryFormTree example

$this->view = new FormView();
        $this->childView = new FormView();
    }

    public function testBuildPreliminaryFormTree()
    {
        $this->form->add($this->childForm);

        $this->dataCollector->collectConfiguration($this->form);
        $this->dataCollector->collectDefaultData($this->form);
        $this->dataCollector->collectSubmittedData($this->form);
        $this->dataCollector->buildPreliminaryFormTree($this->form);

        $childFormData = [
            'id' => 'name_child',
            'name' => 'child',
            'type_class' => FormType::class,
            'synchronized' => true,
            'passed_options' => [],
            'resolved_options' => $this->childForm->getConfig()->getOptions(),
            'default_data' => [
                'norm' => null,
                'view' => '',
            ],

    public function postSubmit(FormEvent $event)
    {
        if ($event->getForm()->isRoot()) {
            // Collect the submitted data of each form             $this->dataCollector->collectSubmittedData($event->getForm());

            // Assemble a form tree             // This is done again after the view is built, but we need it here as the view is not always created.             $this->dataCollector->buildPreliminaryFormTree($event->getForm());
        }
    }
}
Home | Imprint | This part of the site doesn't use cookies.