我正在尝试在 Symfony 2.3 中使用 FOSFacebookBundle,正如它在https://github.com/FriendsOfSymfony/FOSFacebookBundle/blob/master/Resources/doc/2-integration-with-fosuserbundle.md中所说的那样,但我总是得到错误:无法解决致命错误:在 app/cache/de_/ap_DevDebugProjectContainer.php 中找不到 Class My\UserBundle\Security\User\Provider\FacebookProvider'
我尝试了多种方法,但找不到问题所在。
我的代码示例-
安全.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 }
配置.yml
services:
my.facebook.user:
class: My\UserBundle\Security\User\Provider\FacebookProvider
arguments:
facebook: "@fos_facebook.api"
userManager: "@fos_user.user_manager"
validator: "@validator"
参数.yml
facebook.app_id: xxxxxxx
facebook.app_secret: xxxxxxxxx