[DoctrineBridge] Fix deprecation message/documentation of implementing UserProviderInterface using the entity provider

This commit is contained in:
Robin Chalas 2016-11-16 19:01:25 +01:00
parent 9b9f1be117
commit 127af5765c
No known key found for this signature in database
GPG Key ID: 89672113756EE03B
5 changed files with 16 additions and 1 deletions

View File

@ -658,3 +658,8 @@ Routing
// url generated in @router service // url generated in @router service
$router->generate('blog_show', array('slug' => 'my-blog-post'), UrlGeneratorInterface::ABSOLUTE_URL); $router->generate('blog_show', array('slug' => 'my-blog-post'), UrlGeneratorInterface::ABSOLUTE_URL);
``` ```
DoctrineBridge
--------------
* Deprecated using the entity provider with a Doctrine repository implementing `UserProviderInterface`.
Make it implement `UserLoaderInterface` instead.

View File

@ -202,6 +202,9 @@ UPGRADE FROM 2.x to 3.0
closures, but the closure is now resolved in the type instead of in the closures, but the closure is now resolved in the type instead of in the
loader. loader.
* Using the entity provider with a Doctrine repository implementing `UserProviderInterface` is not supported anymore.
You should make the repository implement `UserLoaderInterface` instead.
### EventDispatcher ### EventDispatcher
* The interface `Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcherInterface` * The interface `Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcherInterface`

View File

@ -1,6 +1,12 @@
CHANGELOG CHANGELOG
========= =========
2.8.0
-----
* deprecated using the entity provider with a Doctrine repository implementing UserProviderInterface
* added UserLoaderInterface for loading users through Doctrine.
2.7.0 2.7.0
----- -----

View File

@ -55,7 +55,7 @@ class EntityUserProvider implements UserProviderInterface
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))); 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)));
} }
@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); @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);
} }
$user = $repository->loadUserByUsername($username); $user = $repository->loadUserByUsername($username);

View File

@ -81,6 +81,7 @@ class EntityUserProviderTest extends \PHPUnit_Framework_TestCase
/** /**
* @group legacy * @group legacy
* @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.
*/ */
public function testLoadUserByUsernameWithUserProviderRepositoryAndWithoutProperty() public function testLoadUserByUsernameWithUserProviderRepositoryAndWithoutProperty()
{ {