Symfony-Formular mit UnterformularPhp

PHP-Programmierer chatten hier
Guest
 Symfony-Formular mit Unterformular

Post by Guest »

Ich habe ein Benutzerformular und ein Kontaktformular in meinem Benutzerformular. Ich habe versucht, mein Kontaktformular zum Benutzerformular hinzuzufügen.

Beim Versuch, es hinzuzufügen

Code: Select all

$builder->add(
'contact',
new ContactType()
);
Es ist fehlgeschlagen mit

Code: Select all

You cannot add children to a simple form.
Maybe you should set the option "compound" to true?
versuchte, die Verbindung festzulegen, hat aber nicht funktioniert

Code: Select all

/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$defaults = array(
'compound' => true,
'inherit_data' => true,
);

$resolver->setDefaults($defaults);
}

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post