src/Entity/UserToken.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\UserTokenRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. /**
  6.  * @ORM\Entity(repositoryClass=UserTokenRepository::class)
  7.  * @ORM\Table(schema="bdnf", options={"comment='Contient les tokens des utilisateurs'"})
  8.  */
  9. class UserToken
  10. {
  11.     public function toArray()
  12.     {
  13.         return [
  14.             'expireDate' => $this->getExpireDate(),
  15.             'token' => $this->getToken(),
  16.         ];
  17.     }
  18.     /**
  19.      * @ORM\Id
  20.      * @ORM\GeneratedValue
  21.      * @ORM\Column(type="integer", options={"comment":"Identifiant unique du token"})
  22.      */
  23.     private $id;
  24.     /**
  25.      * @ORM\ManyToOne(targetEntity=User::class)
  26.      * @ORM\JoinColumn(name="user",onDelete="CASCADE")
  27.      */
  28.     private $user;
  29.     /**
  30.      * @ORM\Column(type="string", length=255, options={"comment":"Token de l'utilisateur"})
  31.      */
  32.     private $token;
  33.     /**
  34.      * @ORM\Column(type="datetime", length=255, options={"comment":"Date d'expiration du token"})
  35.      */
  36.     private $expireDate;
  37.     /**
  38.      * @ORM\Column(type="datetime", nullable=true, options={"comment":"Date de la dernière mise à jour du token"})
  39.      */
  40.     private $lastUpdate;
  41.     /**
  42.      * @return mixed
  43.      */
  44.     public function getLastUpdate()
  45.     {
  46.         return $this->lastUpdate;
  47.     }
  48.     /**
  49.      * @param mixed $lastUpdate
  50.      */
  51.     public function setLastUpdate($lastUpdate): void
  52.     {
  53.         $this->lastUpdate $lastUpdate;
  54.     }
  55.     public function getId(): ?int
  56.     {
  57.         return $this->id;
  58.     }
  59.     /**
  60.      * @return mixed
  61.      */
  62.     public function getUser()
  63.     {
  64.         return $this->user;
  65.     }
  66.     /**
  67.      * @param mixed $user
  68.      */
  69.     public function setUser($user): void
  70.     {
  71.         $this->user $user;
  72.     }
  73.     /**
  74.      * @return mixed
  75.      */
  76.     public function getToken()
  77.     {
  78.         return $this->token;
  79.     }
  80.     /**
  81.      * @param mixed $token
  82.      */
  83.     public function setToken($token): void
  84.     {
  85.         $this->token $token;
  86.     }
  87.     /**
  88.      * @return mixed
  89.      */
  90.     public function getExpireDate()
  91.     {
  92.         return $this->expireDate;
  93.     }
  94.     /**
  95.      * @param mixed $expireDate
  96.      */
  97.     public function setExpireDate($expireDate): void
  98.     {
  99.         $this->expireDate $expireDate;
  100.     }
  101. }