Skip to content
This repository has been archived by the owner on Jul 4, 2018. It is now read-only.

The #1611 patch does not treat the user provider as a service #1630

Closed
skalpa opened this issue Mar 20, 2018 · 1 comment
Closed

The #1611 patch does not treat the user provider as a service #1630

skalpa opened this issue Mar 20, 2018 · 1 comment

Comments

@skalpa
Copy link
Contributor

skalpa commented Mar 20, 2018

@henrikbjorn @hkdobrev To create an alias to an already registered service you have to use a closure that accesses the service and cannot just copy the factory with raw(). Failure to do so may result in the instanciation of your object twice.

In the new test, this will fail while it should work:
$this->assertSame($app['my_user_provider'], $app['security.user_provider.default']);

To fix that, you need to replace $users = $app->raw($users) in the provider with:

$users = function () use ($app, $users) {
    return $app[$users];
};

PS: Apologies for not sending a PR, I'm barely able to find free time for reviews.

@hkdobrev
Copy link
Contributor

Thanks! Addressed in #1631.

fabpot added a commit that referenced this issue Mar 22, 2018
…er (hkdobrev)

This PR was merged into the 2.3.x-dev branch.

Discussion
----------

Treat user provider as a service in security service provider

Follow-up to #1611 and #1217.
Fixes #1630.

Commits
-------

c6f14e8 Treat user provider as a service in security service provider
symfony-splitter pushed a commit to silexphp/Silex-Providers that referenced this issue Mar 22, 2018
Follow-up to silexphp/Silex#1611
and silexphp/Silex#1217.
Fixes silexphp/Silex#1630.

Co-authored-by: Pascal Luna <skalpa@zetareticuli.org>
Co-authored-by: Haralan Dobrev <harry@hkdobrev.com>
symfony-splitter pushed a commit to silexphp/Silex-Providers that referenced this issue Mar 22, 2018
…er (hkdobrev)

This PR was merged into the 2.3.x-dev branch.

Discussion
----------

Treat user provider as a service in security service provider

Follow-up to silexphp/Silex#1611 and silexphp/Silex#1217.
Fixes silexphp/Silex#1630.

Commits
-------

c6f14e8 Treat user provider as a service in security service provider
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants