0
我創建了一個客戶表單。Symfony映射子表格
CustomerType
$builder
->add('username', 'text', array(
'label' => 'customer.form.email',
))
->add('plainPassword', 'text', array(
'label' => 'customer.form.password',
))
->add('address', new AddressType)
;
要輸入我想使用第二種形式的地址。
地址類型
類包含一個形式字段。 默認: 'data_class'=> '客戶捆綁\實體\地址' 提交表單後
結果
Customer:
#id: 0
#username: 'test'
...
#address: ArrayCollection
我需要:
Customer:
#id: 0
#username: 'test'
...
#address: Address
有一個簡單的方法到這個解決方案?
您是否嘗試過這個設置http://stackoverflow.com/questions/14853709/embed-one-form -into-another-symfony2? –
請爲您的客戶實體和地址類型提供代碼。 ..它應該沒有集聚,除非你把它映射到實體上作爲集合(例如多對某事) – nakashu