简体   繁体   中英

Symfony2 sonata admin bundle list mapping with mongodb odm

I have a collection 'Category' which contains its parent and childs in itself.

I am using sonata admin bundle to generate list. And I want is to list the categories in such a way that the default list should contains only the top level categories (ie only those categories which do not have parents).

And with a link to sub-categories list all the child categories of that particular parent category.

How could I do that?

First define method createQuery in your admin which restricts query to top parents. When children are in collection self referenced to entity Category then you can display this collenction in list column.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM