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

Move Provider logic in a compilerpass #67

Merged
merged 4 commits into from
Oct 15, 2015

Conversation

jderusse
Copy link
Contributor

This PR allow users to define their own Providers.
Fixes #66

Sample of use

swarrot:
    provider: redis

services:
    app.swarrot.provider_factory:
        class: AppBundle\Provider\RedisFactory
        tags:
            - {name: swarrot.provider_factory, alias: redis}

@jderusse jderusse changed the title Move Provider logic in a compilerpass [WIP] Move Provider logic in a compilerpass Sep 22, 2015
@jderusse jderusse changed the title [WIP] Move Provider logic in a compilerpass Move Provider logic in a compilerpass Sep 23, 2015
@odolbeau
Copy link
Member

Thanks for this contribution, it definitively sounds like a very good idea. :)

Can you correct tests please?

@jderusse
Copy link
Contributor Author

Done.

Thanks @Taluu for the initial PR ;)


$id = $providersIds[$provider];
$definition = $container->getDefinition($id);
$reflection = new \ReflectionClass($definition->getClass());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is broken in case the class is defined with a parameter. You need to resolve the value first

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch !

odolbeau added a commit that referenced this pull request Oct 15, 2015
Move Provider logic in a compilerpass
@odolbeau odolbeau merged commit 8220702 into swarrot:master Oct 15, 2015
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

Successfully merging this pull request may close these issues.

4 participants