Skip to content

Commit d987c40

Browse files
committed
minor symfony#20540 [DoctrineBridge] Fix deprecation message/documentation of implementing UserProviderInterface using the entity provider (chalasr)
This PR was merged into the 2.8 branch. Discussion ---------- [DoctrineBridge] Fix deprecation message/documentation of implementing UserProviderInterface using the entity provider | Q | A | ------------- | --- | Branch? | 2.8 | Bug fix? | yes (but the behavior doesn't change) | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | symfony#20514 | License | MIT | Doc PR | symfony/symfony-docs#5993 (already merged) Commits ------- 127af57 [DoctrineBridge] Fix deprecation message/documentation of implementing UserProviderInterface using the entity provider
2 parents 6095835 + 127af57 commit d987c40

File tree

5 files changed

+16
-1
lines changed

5 files changed

+16
-1
lines changed

UPGRADE-2.8.md

+5
Original file line numberDiff line numberDiff line change
@@ -658,3 +658,8 @@ Routing
658658
// url generated in @router service
659659
$router->generate('blog_show', array('slug' => 'my-blog-post'), UrlGeneratorInterface::ABSOLUTE_URL);
660660
```
661+
662+
DoctrineBridge
663+
--------------
664+
* Deprecated using the entity provider with a Doctrine repository implementing `UserProviderInterface`.
665+
Make it implement `UserLoaderInterface` instead.

UPGRADE-3.0.md

+3
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,9 @@ UPGRADE FROM 2.x to 3.0
202202
closures, but the closure is now resolved in the type instead of in the
203203
loader.
204204

205+
* Using the entity provider with a Doctrine repository implementing `UserProviderInterface` is not supported anymore.
206+
You should make the repository implement `UserLoaderInterface` instead.
207+
205208
### EventDispatcher
206209

207210
* The interface `Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcherInterface`

src/Symfony/Bridge/Doctrine/CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
CHANGELOG
22
=========
33

4+
2.8.0
5+
-----
6+
7+
* deprecated using the entity provider with a Doctrine repository implementing UserProviderInterface
8+
* added UserLoaderInterface for loading users through Doctrine.
9+
410
2.7.0
511
-----
612

src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function loadUserByUsername($username)
5555
throw new \InvalidArgumentException(sprintf('You must either make the "%s" entity Doctrine Repository ("%s") implement "Symfony\Bridge\Doctrine\Security\User\UserLoaderInterface" or set the "property" option in the corresponding entity provider configuration.', $this->classOrAlias, get_class($repository)));
5656
}
5757

58-
@trigger_error('Implementing loadUserByUsername from Symfony\Component\Security\Core\User\UserProviderInterface is deprecated since version 2.8 and will be removed in 3.0. Implement the Symfony\Bridge\Doctrine\Security\User\UserLoaderInterface instead.', E_USER_DEPRECATED);
58+
@trigger_error('Implementing Symfony\Component\Security\Core\User\UserProviderInterface in a Doctrine repository when using the entity provider is deprecated since version 2.8 and will not be supported in 3.0. Make the repository implement Symfony\Bridge\Doctrine\Security\User\UserLoaderInterface instead.', E_USER_DEPRECATED);
5959
}
6060

6161
$user = $repository->loadUserByUsername($username);

src/Symfony/Bridge/Doctrine/Tests/Security/User/EntityUserProviderTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ public function testLoadUserByUsernameWithUserLoaderRepositoryAndWithoutProperty
8181

8282
/**
8383
* @group legacy
84+
* @expectedDeprecation Implementing Symfony\Component\Security\Core\User\UserProviderInterface in a Doctrine repository when using the entity provider is deprecated since version 2.8 and will not be supported in 3.0. Make the repository implement Symfony\Bridge\Doctrine\Security\User\UserLoaderInterface instead.
8485
*/
8586
public function testLoadUserByUsernameWithUserProviderRepositoryAndWithoutProperty()
8687
{

0 commit comments

Comments
 (0)