Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecation messages for created service #60

Closed
TacoV opened this issue Sep 16, 2017 · 5 comments
Closed

Deprecation messages for created service #60

TacoV opened this issue Sep 16, 2017 · 5 comments
Assignees

Comments

@TacoV
Copy link

TacoV commented Sep 16, 2017

With the following basic config:

knpu_oauth2_client:
    clients:
        # the key "facebook" can be anything, it
        # will create a service: "knpu.oauth2.client.facebook"
        facebook:
            # this will be one of the supported types
            type: facebook

The following deprecation messages arise:

Autowiring services based on the types they implement is deprecated since Symfony 3.3 and won't be supported in version 4.0. You should rename (or alias) the "knpu.oauth2.provider.facebook" service to "League\OAuth2\Client\Provider\Facebook" instead.

@weaverryan
Copy link
Member

weaverryan commented Sep 20, 2017

Yo @TacoV!

Can you post a bit more code? Specifically, it looks like you're autowiring the Facebook class into some service. Is that correct? Why did you decide to autowire the Facebook class instead of the FacebookClient from the bundle?

To support autowiring, what we need to do is create a service alias for each client (unless you, for some reason, have 2 clients with the same type... which really shouldn't happen). For example, we need an alias from KnpU\OAuth2ClientBundle\Client\Provider\FacebookClient to knpu.oauth2.client.facebook (assuming the config key the user created is called facebook, like in the above code). I'm not sure We could also create aliases for the provider classes too (e.g. League\OAuth2\Client\Provider\Facebook), but I'm not sure, as I didn't really intend for people to use these directly (as @TacoV as doing), but there may not be any harm.

And we also need an alias from KnpU\OAuth2ClientBundle\Client\ClientRegistry to oauth2.registry, as this is the main way to use the library.

Finally, we should update the docs to assume that autowiring is being used.

Any volunteers? :)

@MolloKhan MolloKhan self-assigned this Sep 21, 2017
@TacoV
Copy link
Author

TacoV commented Sep 22, 2017

Thanks, I found it! I previously (as in, before this bundle came out) tried to hook up the league client by myself. One legacy method still had some code pointing directly to this client...
public function mergeEmailAndFacebookAction(League\OAuth2\Client\Provider\Facebook $fb)
I removed this method and now the rest (still) works like a charm, without the deprecation messages!

@TacoV TacoV closed this as completed Sep 22, 2017
@weaverryan
Copy link
Member

Awesome! Thank you for the update! I'm actually going to re-open this issue, because we do still need to add some aliases to make autowiring easier. But, you've at least clarified the issue :). We only need to:

A) Add aliases for each configured client class (e.g. KnpU\OAuth2ClientBundle\Client\Provider\FacebookClient to knpu.oauth2.client.facebook)

B) An alias from KnpU\OAuth2ClientBundle\Client\ClientRegistry to oauth2.registry

Cheers!

@TacoV
Copy link
Author

TacoV commented Sep 27, 2017

If the syntax of #62 is correct, I'll copy-paste it to include all other current services (A) and likewise add the registry alias (B).

@MolloKhan
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants