2015-03-31 56 views
0

我在我的config.yml中有一些设置,我想将其作为参数传递给services.yml中的服务。将config.yml设置注入服务

#config.yml 
hwi_oauth: 
resource_owners: 
     facebook: 
      type:    facebook 
      client_id:   %facebook_app_id% 
      client_secret:  %facebook_app_secret% 
      scope:    "email, public_profile, user_friends" 
      infos_url:  "https://graph.facebook.com/me?fields=id,name,email,picture.type(square)" 
      paths: 
       email:   email 
       profilepicture: picture.data.url 
      options: 
       display: popup #dialog is optimized for popup window 


#services.yml 
hwi_oauth.resource_owner.facebook: 
     class: AppBundle\OAuth\ResourceOwner\FacebookResourceOwner 
     arguments: ['@hwi_oauth.http_client','@security.http_utils',**{INJECT HERE}**,'@hwi_oauth.storage.session'] 

我该怎么做?

回答

1

将这些值作为参数。您可以将参数注入服务。

+0

有没有办法做到这一点,而无需手动输入......?在config.yml中有什么意义,然后 – Chris 2015-03-31 18:01:47

+0

参数是机器特定的选项,配置应该是特定于环境的。您可以从扩展设置参数: /bundles/prepend_extension.html – Greg 2015-03-31 18:08:39