|
|
|
@ -17,15 +17,12 @@ use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
|
|
|
|
|
* @method User[] findAll()
|
|
|
|
|
* @method User[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
|
|
|
|
*/
|
|
|
|
|
class UserRepository extends ServiceEntityRepository implements PasswordUpgraderInterface
|
|
|
|
|
{
|
|
|
|
|
public function __construct(ManagerRegistry $registry)
|
|
|
|
|
{
|
|
|
|
|
class UserRepository extends ServiceEntityRepository implements PasswordUpgraderInterface {
|
|
|
|
|
public function __construct (ManagerRegistry $registry) {
|
|
|
|
|
parent::__construct($registry, User::class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function save(User $entity, bool $flush = false): void
|
|
|
|
|
{
|
|
|
|
|
public function save (User $entity, bool $flush = false): void {
|
|
|
|
|
$this->getEntityManager()->persist($entity);
|
|
|
|
|
|
|
|
|
|
if ($flush) {
|
|
|
|
@ -33,8 +30,7 @@ class UserRepository extends ServiceEntityRepository implements PasswordUpgrader
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function remove(User $entity, bool $flush = false): void
|
|
|
|
|
{
|
|
|
|
|
public function remove (User $entity, bool $flush = false): void {
|
|
|
|
|
$this->getEntityManager()->remove($entity);
|
|
|
|
|
|
|
|
|
|
if ($flush) {
|
|
|
|
@ -45,8 +41,7 @@ class UserRepository extends ServiceEntityRepository implements PasswordUpgrader
|
|
|
|
|
/**
|
|
|
|
|
* Used to upgrade (rehash) the user's password automatically over time.
|
|
|
|
|
*/
|
|
|
|
|
public function upgradePassword(PasswordAuthenticatedUserInterface $user, string $newHashedPassword): void
|
|
|
|
|
{
|
|
|
|
|
public function upgradePassword (PasswordAuthenticatedUserInterface $user, string $newHashedPassword): void {
|
|
|
|
|
if (!$user instanceof User) {
|
|
|
|
|
throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', \get_class($user)));
|
|
|
|
|
}
|
|
|
|
|