我正试图在Symfony 2.3中使用FOSFacebookBundle,正如它在https://github.com/FriendsOfSymfony/FOSFacebookBundle/blob/master/Resources/doc/2-integration-with-fosuserbundle.md中所说,但我总是得到错误: 无法解决致命错误:在app / cache / de_ / ap_DevDebugProjectContainer.php中找不到类My \ UserBundle \ Security \ User \ Provider \ FacebookProvider
我尝试了很多东西,却找不到它的错误。
我的代码示例 -
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