我試圖合併FOSFacebookBundle和FOSUserBundle。單獨FosUserBundle工作完美,但是當我試圖facebookbundle他整合即時得到使用的Symfony 2.3.4路線error.I'mFOSFacebookBundle無法導入資源路由
不能「@ FOSFacebookBundle /資源/配置/ routing.xml」從 進口資源 「C:/ XAMPP/htdocs中/ Symfonia /應用/配置\ routing.yml中」。確保在應用程序內核類中註冊並加載了 「FOSFacebookBundle/Resources/config/routing.xml」軟件包 。
我在routing.yml的每個地方都有4個空格鍵。 Ofcourse我實現了它在AppKernel.php
我的routing.yml:
fos_user_security:
resource: "@FOSUserBundle/Resources/config/routing/security.xml"
fos_user_profile:
resource: "@FOSUserBundle/Resources/config/routing/profile.xml"
prefix: /profile
fos_user_register:
resource: "@FOSUserBundle/Resources/config/routing/registration.xml"
prefix: /register
fos_user_resetting:
resource: "@FOSUserBundle/Resources/config/routing/resetting.xml"
prefix: /resetting
fos_user_change_password:
resource: "@FOSUserBundle/Resources/config/routing/change_password.xml"
prefix: /profile
_welcome:
pattern:/
defaults: { _controller: AcmeUserBundle:Welcome:index }
_security_check:
pattern: /login_fb_check
_security_logout:
pattern: /logout
fos_facebook_channel:
resource: "@FOSFacebookBundle/Resources/config/routing.xml"
Config.yml
imports:
- { resource: parameters.yml }
- { resource: security.yml }
services:
my.facebook.user:
class: Acme\UserBundle\Security\User\Provider\FacebookProvider
arguments:
facebook: "@fos_facebook.api"
userManager: "@fos_user.user_manager"
validator: "@validator"
framework:
#esi: ~
translator: { fallback: %locale% }
secret: %secret%
router:
resource: "%kernel.root_dir%/config/routing.yml"
strict_requirements: ~
form: ~
csrf_protection: ~
validation: { enable_annotations: true }
templating:
engines: ['twig']
#assets_version: SomeVersionScheme
default_locale: "%locale%"
trusted_proxies: ~
session: ~
fragments: ~
http_method_override: true
# Twig Configuration
twig:
debug: %kernel.debug%
strict_variables: %kernel.debug%
# Assetic Configuration
assetic:
debug: %kernel.debug%
use_controller: false
bundles: [ ]
#java: /usr/bin/java
filters:
cssrewrite: ~
#closure:
# jar: %kernel.root_dir%/Resources/java/compiler.jar
#yui_css:
# jar: %kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar
# Doctrine Configuration
doctrine:
dbal:
driver: %database_driver%
host: %database_host%
port: %database_port%
dbname: %database_name%
user: %database_user%
password: %database_password%
charset: UTF8
# if using pdo_sqlite as your database driver, add the path in parameters.yml
# e.g. database_path: %kernel.root_dir%/data/data.db3
# path: %database_path%
orm:
auto_generate_proxy_classes: %kernel.debug%
auto_mapping: true
# Swiftmailer Configuration
swiftmailer:
transport: %mailer_transport%
host: %mailer_host%
username: %mailer_user%
password: %mailer_password%
spool: { type: memory }
fos_user:
db_driver: orm
firewall_name: main
user_class: Acme\UserBundle\Entity\User
fos_facebook:
alias: facebook
app_id: 123456879
secret: s3cr3t
cookie: true
permissions: [email, user_birthday, user_location]
和我security.yml
security:
providers:
chain_provider:
chain:
providers: [fos_user_bundle, my_fos_facebook_provider]
fos_user_bundle:
id: fos_user.user_provider.username
my_fos_facebook_provider:
id: my.facebook.user
encoders:
FOS\UserBundle\Model\UserInterface: sha512
firewalls:
main:
pattern: ^/
form_login:
provider: chain_provider
csrf_provider: form.csrf_provider
fos_facebook:
app_url: "http://apps.facebook.com/appName/"
server_url: "http://localhost/facebookApp/"
login_path: /login
check_path: /login_fb_check
default_target_path:/
provider: chain_provider
logout: true
anonymous: true
access_control:
- { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/admin/, role: ROLE_ADMIN }
- { path: ^/facebook/, role: [ROLE_FACEBOOK] }
- { path: ^/.*, role: [IS_AUTHENTICATED_ANONYMOUSLY] }
role_hierarchy:
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: ROLE_ADMIN
感謝您的幫助!
是的,就是這樣!謝謝! – Kielus
如果您按照安裝說明進行操作,請注意,它目前告訴您通過Composer安裝'1.2。*',但在此版本之後引入了'routing.xml'文件*,因此它僅存在於主分支中 - 這就是爲什麼沒有找到 – richsage