src/Entity/ResetPassword.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use DateTimeInterface;
  4. use Doctrine\ORM\Mapping as ORM;
  5. /**
  6.  * @ORM\Entity(repositoryClass="App\Repository\ResetPasswordRepository")
  7.  */
  8. class ResetPassword
  9. {
  10.     /**
  11.      * @ORM\Id()
  12.      * @ORM\GeneratedValue()
  13.      * @ORM\Column(type="integer")
  14.      */
  15.     private $id;
  16.     /**
  17.      * @ORM\Column(type="string", length=50)
  18.      */
  19.     private $identifier;
  20.     /**
  21.      * @ORM\Column(type="datetime")
  22.      */
  23.     private $linkExpireDateTime;
  24.     /**
  25.      * @ORM\OneToOne(targetEntity="App\Entity\User", inversedBy="resetPassword")
  26.      * @ORM\JoinColumn(name="user_id", referencedColumnName="id",  onDelete="CASCADE")
  27.      */
  28.     private $user;
  29.     /**
  30.      * Constructor
  31.      */
  32.     public function __construct()
  33.     {
  34.         $this->identifier md5(uniqid(rand(), true));
  35.     }
  36.     public function getId(): ?int
  37.     {
  38.         return $this->id;
  39.     }
  40.     public function getIdentifier(): ?string
  41.     {
  42.         return $this->identifier;
  43.     }
  44.     public function setIdentifier(string $identifier): self
  45.     {
  46.         $this->identifier $identifier;
  47.         return $this;
  48.     }
  49.     public function getLinkExpireDateTime(): ?DateTimeInterface
  50.     {
  51.         return $this->linkExpireDateTime;
  52.     }
  53.     public function setLinkExpireDateTime(DateTimeInterface $linkExpireDateTime): self
  54.     {
  55.         $this->linkExpireDateTime $linkExpireDateTime->modify("+1 day");
  56.         return $this;
  57.     }
  58.     public function getUser(): ?User
  59.     {
  60.         return $this->user;
  61.     }
  62.     public function setUser(?User $user): self
  63.     {
  64.         $this->user $user;
  65.         return $this;
  66.     }
  67. }