Symfony2 SonataAdmin + EDBlogBundle in PROD environment with a specific role
<p>I switched to my prod environemnt today and started testing. Everything is working great with my admin user. The problem is when I switch to another user, that has a role <code>PROVIDER</code>. This user is only able to add products or import them in admin panel. However, when I go to admin dashboard I get these errors:</p>

<pre><code> Warning: Missing argument 1 for Sonata\AdminBundle\Admin\Admin::__construct(), called in C:\wamp\www\karpedeal_b2c\vendor\ed\blog-bundle\Security\Authorization\Voter\ArticleVoter.php on line 37 and defined in C:\wamp\www\karpedeal_b2c\app\cache\prod\classes.php on line 5473
</code></pre>

<p>No idea whats going on since in DEV environment everything works. I can login with provider user, import products etc... in prod, i cant.</p>

<p>For some reason it is trying to access somethin in the blog bundle, however this user does not have any rights to blogs... What is the problem then?</p>

<pre><code>role_hierarchy:
        ROLE_PROVIDER:    [ROLE_USER, ROLE_SONATA_PROVIDER]
        ROLE_ADMIN:       [ROLE_USER, ROLE_SONATA_PROVIDER, ROLE_SONATA_ADMIN, ROLE_BLOG_USER, ROLE_BLOG_ADMIN]
        ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
        ROLE_SONATA_PROVIDER:
            - ROLE_MP_SHOP_ADMIN_PRODUCT_LIST
            - ROLE_MP_SHOP_ADMIN_PRODUCT_VIEW
            - ROLE_MP_SHOP_ADMIN_IMPORTER_LIST
            - ROLE_MP_SHOP_ADMIN_IMPORT_SCHEMA_CREATE
            - ROLE_MP_SHOP_ADMIN_IMPORT_SCHEMA_LIST
        SONATA:
            - ROLE_SONATA_PAGE_ADMIN_PAGE_EDIT  # if you are using acl then this line must be commented
        ROLE_SONATA_EMPLOYEE:
            - ROLE_MP_SHOP_ADMIN_PRODUCT_LIST
            - ROLE_MP_SHOP_ADMIN_PRODUCT_VIEW

firewalls:
        # disables authentication for assets and the profiler, adapt it according to your needs
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false

        admin:
            pattern:            /admin(.*)
            context:            user
            form_login:
                provider:       fos_userbundle
                login_path:     /admin/login
                use_forward:    false
                check_path:     /admin/login_check
                failure_path:   null
            logout:
                path:           /admin/logout
            anonymous:          true

        main:
            pattern:             ^/
            context:             user
            form_login:
                provider:       fos_userbundle
                csrf_provider: form.csrf_provider
                login_path:     /login
                #use_forward:    false
                check_path:     fos_user_security_check
                #failure_path:   null
                always_use_default_target_path: false
                default_target_path: profile
            logout:
                path:   fos_user_security_logout
            oauth:
                resource_owners:
                    facebook:      "/login/check-facebook"
                login_path:        /login
                failure_path:      /login
                oauth_user_provider:
                    service: my_user_provider
            anonymous:          true
        default:
            anonymous: ~
            # activate different ways to authenticate
    access_control:
        # URL of FOSUserBundle which need to be available to anonymous users
        - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }

        # Admin login page needs to be access without credential
        - { path: ^/admin/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/admin/logout$, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/admin/login_check$, role: IS_AUTHENTICATED_ANONYMOUSLY }

        # Secured part of the site
        # This config requires being logged for the whole site and having the admin role for the admin part.
        # Change these rules to adapt them to your needs
        - { path: ^/admin/, role: [ROLE_PROVIDER, ROLE_ADMIN, ROLE_SONATA_ADMIN, ROLE_SONATA_PROVIDER] }
        - { path: ^/.*, role: IS_AUTHENTICATED_ANONYMOUSLY }

    acl:
        connection: default
</code></pre>

<p>UPDATE: </p>

<p>When changing AppKernel <code>$kernel = new AppKernel('prod', true);</code>everything works, so the debugger is causing the problems? How can that be?</p>