0
votes

I have a Product table and a Brand table. Brand table contains a product id. I am using Sonata admin bundle to set up the admin. 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.

1
It will be easier if you set a relation between your 2 entitiesrpg600
I figured out how to add new brands. I used 'sonata_type_collection'. I get a 'Add new' button. But I still couldn't find out how to list the child table.GBRocks

1 Answers

0
votes

The code below solves the issue.

->add('brands', 'sonata_type_collection', array(
                        'by_reference' => true
        ), array(
                        'edit' => 'inline',
                        'inline' => 'table',
                        'sortable' => 'position',
        ))