Fatal error: Class My\UserBundle\Security\User\Provider\FacebookProvider

205 views Asked by At

I'm trying to use FOSFacebookBundle in Symfony 2.3 as it says in https://github.com/FriendsOfSymfony/FOSFacebookBundle/blob/master/Resources/doc/2-integration-with-fosuserbundle.md but I always get the error: Can't solve Fatal error: Class My\UserBundle\Security\User\Provider\FacebookProvider' not found in app/cache/de_/ap_DevDebugProjectContainer.php

I have tryed multiple things, but can't find what it is wrong.

My code sample-

Security.yml

security:
encoders:
    FOS\UserBundle\Model\UserInterface: sha512

role_hierarchy:
    ROLE_ADMIN:       ROLE_USER
    ROLE_SUPER_ADMIN: ROLE_ADMIN

providers:
    chain_provider:
      chain:
        providers: [fos_userbundle, my_fos_facebook_provider]
    fos_userbundle:
      id: fos_user.user_provider.username
    my_fos_facebook_provider:
      id: my.facebook.user

firewalls:
    main:
        pattern: ^/
        form_login:
            provider: fos_userbundle
            csrf_provider: form.csrf_provider
        logout:       true
        anonymous:    true
    public:
        pattern:   ^/.*
        fos_facebook:
            app_url: "xxxxxx"
            server_url: "xxxxxx"
            login_path: /login
            check_path: /login_fb_check
            default_target_path: /
        anonymous: true
access_control:
    - { path: ^/secured/.*, role: [IS_AUTHENTICATED_FULLY] }
    - { path: ^/.*, role: [IS_AUTHENTICATED_ANONYMOUSLY] }
    - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/admin/, role: ROLE_ADMIN }

config.yml

services:
    my.facebook.user:
        class: My\UserBundle\Security\User\Provider\FacebookProvider
        arguments:
            facebook: "@fos_facebook.api"
            userManager: "@fos_user.user_manager"
            validator: "@validator"

parameters.yml

facebook.app_id: xxxxxxx
facebook.app_secret: xxxxxxxxx
0

There are 0 answers