Search code examples
phpsymfonysonata-adminsymfony-sonatasonata

Only two admin panels showing in Sonata Admin dashboard


I am using Sonata Admin in my Symfony 2 project to setup three admin panels to show on my dashboard at /admin/dashboard/. One for Common, Contact and Gallery.

They all work independently, however it appears I am limited to two for some reason as when I add the GalleryBundle line below I lose the CommonBundle admin facility from the dashboard.

# /app/config/config.yml
imports:
    - { resource: parameters.yml }
    - { resource: security.yml }
    - { resource: @AyrshireMinisCommonBundle/Resources/config/admin.yml }
    - { resource: @AyrshireMinisContactBundle/Resources/config/admin.yml }
    - { resource: @AyrshireMinisGalleryBundle/Resources/config/admin.yml }

# Sonata Admin
sonata_admin:
    title:  Ayrshire Minis Admin
    options:
        dropdown_number_groups_per_colums:      3

_I'm aware of the misspelt "columns", this is intentional and is in their documentation.

This is my admin.yml for the GalleryBundle:

services:
    sonata.link.admin.post:
        class: AyrshireMinis\GalleryBundle\Admin\GalleryAdmin
        tags:
            - { name: sonata.admin, manager_type: orm, group: "Gallery", label: "Image" }
        arguments:
            - ~
            - AyrshireMinis\GalleryBundle\Entity\GalleryImage
            - ~
        calls:
            - [ setTranslationDomain, [AyrshireMinisGalleryBundle]]

The third option does not appear in the drop down menu in the nav either:

enter image description here

Oddly now that I have installed User support to Sonata I have three menus (with Users now added) and there are three panels on the dashboard, but yet I can't see the Gallery panel?


Solution

  • I found the problem with this, it was in my GalleryBundle admin.yml (which I had copied from the CommonBundle.

    I had sonata.link.admin.post, so I replaced it with gallery as I imagine it was overwriting it.

    services:
        sonata.gallery.admin.post:
            class: AyrshireMinis\GalleryBundle\Admin\GalleryAdmin
            tags:
                - { name: sonata.admin, manager_type: orm, group: "Gallery", label: "Image" }
            arguments:
                - ~
                - AyrshireMinis\GalleryBundle\Entity\GalleryImage
                - ~
            calls:
                - [ setTranslationDomain, [AyrshireMinisGalleryBundle]]