I have a one (category) to many (product) relationship set up, and I'd like to have a list of products show up at the bottom of the edit category page.
It seems like this would be a common thing to do, but I haven't found any way to do it (or any examples of it). I have managed to get the product to display using sonata_type_collection but that gives me a whole edit form for the Product, when I really just want a list of products associated with the category.
Two questions here, really:
Is this possible?
Is it discouraged (which would explain the lack of examples)? If so, why?
The fastest way to do what you are looking for is overriding the edit template. At your admin serivce declaration you can do so:
Then, under
AcmeBundle/Resources/views/CategoryAdmin/edit.html.twig
you can have something like this: