fix missing implements in the user entity
This commit is contained in:
parent
0ac49a6930
commit
0984edf462
|
@ -84,6 +84,14 @@ class User implements PasswordAuthenticatedUserInterface, UserInterface, TwoFact
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see UserInterface
|
||||||
|
*/
|
||||||
|
public function getUserIdentifier(): string
|
||||||
|
{
|
||||||
|
return $this->getUsername();
|
||||||
|
}
|
||||||
|
|
||||||
public function getEmail(): ?string
|
public function getEmail(): ?string
|
||||||
{
|
{
|
||||||
return $this->email;
|
return $this->email;
|
||||||
|
@ -96,11 +104,6 @@ class User implements PasswordAuthenticatedUserInterface, UserInterface, TwoFact
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* A visual identifier that represents this user.
|
|
||||||
*
|
|
||||||
* @see UserInterface
|
|
||||||
*/
|
|
||||||
public function getUsername(): string
|
public function getUsername(): string
|
||||||
{
|
{
|
||||||
return (string) $this->email;
|
return (string) $this->email;
|
||||||
|
@ -131,9 +134,6 @@ class User implements PasswordAuthenticatedUserInterface, UserInterface, TwoFact
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @see UserInterface
|
|
||||||
*/
|
|
||||||
public function getPassword(): string
|
public function getPassword(): string
|
||||||
{
|
{
|
||||||
return (string) $this->password;
|
return (string) $this->password;
|
||||||
|
@ -146,20 +146,11 @@ class User implements PasswordAuthenticatedUserInterface, UserInterface, TwoFact
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returning a salt is only needed, if you are not using a modern
|
|
||||||
* hashing algorithm (e.g. bcrypt or sodium) in your security.yaml.
|
|
||||||
*
|
|
||||||
* @see UserInterface
|
|
||||||
*/
|
|
||||||
public function getSalt(): ?string
|
public function getSalt(): ?string
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @see UserInterface
|
|
||||||
*/
|
|
||||||
public function eraseCredentials()
|
public function eraseCredentials()
|
||||||
{
|
{
|
||||||
// If you store any temporary, sensitive data on the user, clear it here
|
// If you store any temporary, sensitive data on the user, clear it here
|
||||||
|
|
|
@ -8,6 +8,7 @@ use Doctrine\Persistence\ManagerRegistry;
|
||||||
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
|
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
|
||||||
use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
|
use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
|
||||||
use Symfony\Component\Security\Core\User\UserInterface;
|
use Symfony\Component\Security\Core\User\UserInterface;
|
||||||
|
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
|
||||||
|
|
||||||
class UserRepository extends ServiceEntityRepository implements PasswordUpgraderInterface
|
class UserRepository extends ServiceEntityRepository implements PasswordUpgraderInterface
|
||||||
{
|
{
|
||||||
|
@ -16,7 +17,7 @@ class UserRepository extends ServiceEntityRepository implements PasswordUpgrader
|
||||||
parent::__construct($registry, User::class);
|
parent::__construct($registry, User::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function upgradePassword(UserInterface $user, string $newEncodedPassword): void
|
public function upgradePassword(PasswordAuthenticatedUserInterface $user, string $newEncodedPassword): void
|
||||||
{
|
{
|
||||||
if (!$user instanceof User) {
|
if (!$user instanceof User) {
|
||||||
throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', \get_class($user)));
|
throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', \get_class($user)));
|
||||||
|
|
Loading…
Reference in a new issue