**这是我的控制器**
public function companyConfigAction(Request $ request){
$form = array();
$addCompany = new CompanyAccount();
$addBankDetails = new CompanyBankAccount();
$addCompany->addBankDetails($addBankDetails);
$addCompanyAccountForm = $this->createForm(new CompanyAccountType(), $addCompany);
$addCompanyCommisionForm = $this->createForm(new CompanyBillingCommissionInfoType(), new CompanyBillingCommissionInfo());
$companyContactInfo = new CompanyContactInfo();
$addCompanyContactInfoForm = $this->createForm(new CompanyContactInfoType(), $companyContactInfo);
$addCompanySubscriptionForm = $this->createForm(new CompanyOtherSubscriptionType(), new CompanyOtherSubscription());
return $this->render('BillingInvoiceBundle:Company:configuration.html.twig', [
'entity' => $addCompany,
'companyAccountForm' => $addCompanyAccountForm->createView(),
'companyCommissionForm' => $addCompanyCommisionForm->createView(),
'companyContactInfo' => $addCompanyContactInfoForm->createView(),
'companySubscription' => $addCompanySubscriptionForm->createView(),
]);
}
答案 0 :(得分:0)
如果您想在单个表单中使用所有这些表单,请查看集合表单类型:
http://symfony.com/doc/current/cookbook/form/form_collections.html