I've got a symfony application with the SonataAdminBundle. In version 2.3
everything worked perfectly. When updating to version 3.1
all admins where still shown in the dashboard but only the last of a group was shown in the sitebar menu. I don't know that's a bug or if there's just a new setting I missed. The documentation for the 3.1
is unfortunately not up to date yet.
I use two admin lists to split them into two columns. Here is a snippet from the admin configuration with the groups and the items:
dashboard:
blocks:
- { position: left, type: sonata.admin.block.admin_list, settings: { groups: [product, event] } }
- { position: right, type: sonata.admin.block.admin_list, settings: { groups: [system] } }
groups:
product:
label: group.product
label_catalogue: MyAdminBundle
icon: '<i class="fa fa-shopping-cart"></i>'
items:
- my.admin.product
- my.admin.product_group
- my.admin.product_image
- my.admin.product_media_file
- my.admin.attribute
...
In the dashboard the hole group with all 5 admins is shown. In the sidebar menu only the my.admin.attribute
admin is shown in the product group. This goes for all groups. It's always only the last element which is shown.
Does anyone know what's the reason for this?
The project currently uses symfony/symfony: 2.8.6
and sonata-project/admin-bundle: 3.1.0
.
The problem was that the SonataAdminBundle uses the label
of the admin service as the identifier. All my services had the same label called "title" as this is just translated in the translation file for the admin anyway.
my.admin.product:
class: My\Bundle\AdminBundle\Admin\ProductAdmin
tags:
- { name: sonata.admin, manager_type: orm, label: title }
arguments:
- ~
- My\Bundle\AdminBundle\Entity\Product
- ~
So the solution was to simply change the label to a unique one like product_title
and all the admins are shown again in the sidebar.
You can see the discussion and finding in this ticket. This is also the ticket where they are going to change the identifier to something really unique.