[英]Include two entities in a single class Sonata Admin Bundle
I have a Product table and a Brand table. 我有一个产品表和一个品牌表。 Brand table contains a product id.
品牌表包含产品ID。 I am using Sonata admin bundle to set up the admin.
我正在使用Sonata管理员捆绑包来设置管理员。 I have Product admin class and Brand admin class.
我有产品管理员班和品牌管理员班。 Now I am able to list both the tables.
现在,我可以列出两个表。 When clicked on one of the products, an edit screen comes.
单击其中一种产品时,将出现一个编辑屏幕。 What I want now is, I want to display the corresponding Brand table entries also along with this screen and also be able to add new brands.
我现在想要的是,我还要在此屏幕上显示相应的“品牌”表条目,并且还能够添加新品牌。 Please help me on this.
请帮我。
I have tried something with sonata_type_admin, but could be of no help. 我已经尝试过使用sonata_type_admin进行操作,但是可能没有帮助。
The code below solves the issue. 下面的代码解决了这个问题。
->add('brands', 'sonata_type_collection', array(
'by_reference' => true
), array(
'edit' => 'inline',
'inline' => 'table',
'sortable' => 'position',
))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.