createChildForm example

private FormFactory $factory;
    private FormInterface $form;
    private FormInterface $childForm;
    private FormView $view;
    private FormView $childView;

    protected function setUp(): void
    {
        $this->dataCollector = new FormDataCollector(new FormDataExtractor());
        $this->factory = new FormFactory(new FormRegistry([new CoreExtension()]new ResolvedFormTypeFactory()));
        $this->form = $this->createForm('name');
        $this->childForm = $this->createChildForm('child');
        $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);
        
Home | Imprint | This part of the site doesn't use cookies.