Compare commits

..

1 Commits

Author SHA1 Message Date
Alexey Skobkin 9980288a2a
PHP code modernization work. Not finished. 2022-07-08 05:02:09 +03:00
2 changed files with 12 additions and 5 deletions

View File

@ -10,7 +10,7 @@ use Doctrine\ORM\Mapping as ORM;
class PasswordResetToken
{
#[ORM\ManyToOne(targetEntity: User::class, fetch: 'EAGER')]
#[ORM\JoinColumn(name: '', nullable: false, onDelete: 'CASCADE')]
#[ORM\JoinColumn(name: 'user_id', nullable: false, onDelete: 'CASCADE')]
private User $user;
#[ORM\Id]

View File

@ -24,7 +24,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
#[ORM\Column(name: 'password', type: 'text')]
private string $password;
#[ORM\Column(name: '', type: 'string', length: 254, unique: true)]
#[ORM\Column(name: 'email', type: 'string', length: 254, unique: true)]
private string $email;
#[ORM\Column(name: 'roles', type: 'json')]
@ -51,6 +51,12 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
return $this->id;
}
public function getUserIdentifier(): string
{
return $this->username;
}
/** @deprecated since Symfony 5.3, use getUserIdentifier() instead */
public function getUsername(): string
{
return $this->username;
@ -66,7 +72,8 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
$this->password = $hasher->hash($rawPassword);
}
public function getSalt()
/** @deprecated since Symfony 5.3 */
public function getSalt(): ?string
{
// Salt is not needed when using Argon2i
// @see https://symfony.com/doc/current/reference/configuration/security.html#using-the-argon2i-password-encoder
@ -105,7 +112,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
}
/** @see \Serializable::serialize() */
public function serialize()
public function serialize(): string
{
return serialize([
$this->id,
@ -115,7 +122,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
}
/** @see \Serializable::unserialize() */
public function unserialize($serialized)
public function unserialize($serialized): void
{
[
$this->id,