|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?php
-
- namespace Lc\SovBundle\Repository\User;
-
- use Lc\SovBundle\Model\User\UserInterface;
- use Lc\SovBundle\Repository\AbstractRepository;
- use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
- use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
- use Symfony\Component\Security\Core\User\UserInterface as SfUserInterface;
-
-
- class UserRepository extends AbstractRepository implements PasswordUpgraderInterface
- {
- public function getInterfaceClass()
- {
- return UserInterface::class;
- }
-
-
-
- public function upgradePassword(SfUserInterface $user, string $newEncodedPassword): void
- {
- if (!$user instanceof SfUserInterface) {
- throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', \get_class($user)));
- }
-
- $user->setPassword($newEncodedPassword);
- $this->_em->persist($user);
- $this->_em->flush();
- }
-
-
-
-
-
-
-
-
-
- }
|