Chris
Chris

Reputation: 2446

Inject config.yml settings into service

I have some settings in my config.yml that I would like to pass as an argument to a service in services.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']

How can i do this?

Upvotes: 0

Views: 383

Answers (1)

Greg
Greg

Reputation: 803

Make these values as parameters. You can inject parameters into service.

Upvotes: 1

Related Questions