src/Entity/Accounts/UserRecovery.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Accounts;
  3. use App\Repository\Accounts\UserRecoveryRepository;
  4. use Doctrine\DBAL\Types\Types;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7.  * UserRecovery
  8.  *
  9.  * @ORM\Entity(repositoryClass="App\Repository\Accounts\UserRecoveryRepository")
  10.  * @ORM\Table(name="otp_accounts.userRecovery", indexes={@ORM\Index(name="user_id", columns={"user_id", "date", "hash"}), @ORM\Index(name="ip", columns={"ip", "user_id"}), @ORM\Index(name="date", columns={"date"})})
  11.  */
  12. class UserRecovery
  13. {
  14.     /**
  15.      * @var int
  16.      *
  17.      * @ORM\Column(name="id", type="integer", nullable=false, options={"unsigned"=true})
  18.      * @ORM\Id
  19.      * @ORM\GeneratedValue(strategy="IDENTITY")
  20.      */
  21.     private $id;
  22.     /**
  23.      * @var int
  24.      *
  25.      * @ORM\Column(name="user_id", type="integer", nullable=false, options={"unsigned"=true})
  26.      */
  27.     private $userId;
  28.     /**
  29.      * @ORM\ManyToOne(targetEntity="App\Entity\Accounts\Users", inversedBy="recoveries")
  30.      * @ORM\JoinColumn(name="user_id", referencedColumnName="rec_id", nullable=false, onDelete="CASCADE")
  31.      */
  32.     private $user;
  33.     public function getUser(): ?Users
  34.     {
  35.         return $this->user;
  36.     }
  37.     public function setUser(Users $user): static
  38.     {
  39.         $this->user $user;
  40.         return $this;
  41.     }
  42.     /**
  43.      * @var string
  44.      *
  45.      * @ORM\Column(name="hash", type="string", length=255, nullable=false, options={"fixed"=true})
  46.      */
  47.     private $hash;
  48.     /**
  49.      * @var int
  50.      *
  51.      * @ORM\Column(name="ip", type="bigint", nullable=false)
  52.      */
  53.     private $ip;
  54.     /**
  55.      * @var string
  56.      *
  57.      * @ORM\Column(name="userAgent", type="string", length=255, nullable=false, options={"fixed"=true,"comment"="полная строка браузера"})
  58.      */
  59.     private $useragent;
  60.     /**
  61.      * @var \DateTime
  62.      *
  63.      * @ORM\Column(name="date", type="datetime", nullable=false, options={"default"="CURRENT_TIMESTAMP"})
  64.      */
  65.     private $date 'CURRENT_TIMESTAMP';
  66.     /**
  67.      * @var \DateTime|null
  68.      *
  69.      * @ORM\Column(name="used", type="datetime", nullable=true)
  70.      */
  71.     private $used;
  72.     public function getId(): ?int
  73.     {
  74.         return $this->id;
  75.     }
  76.     public function getUserId(): ?int
  77.     {
  78.         return $this->userId;
  79.     }
  80.     public function setUserId(int $userId): static
  81.     {
  82.         $this->userId $userId;
  83.         return $this;
  84.     }
  85.     public function getHash(): ?string
  86.     {
  87.         return $this->hash;
  88.     }
  89.     public function setHash(string $hash): static
  90.     {
  91.         $this->hash $hash;
  92.         return $this;
  93.     }
  94.     public function getIp(): ?string
  95.     {
  96.         return $this->ip;
  97.     }
  98.     public function setIp(string $ip): static
  99.     {
  100.         $this->ip $ip;
  101.         return $this;
  102.     }
  103.     public function getUseragent(): ?string
  104.     {
  105.         return $this->useragent;
  106.     }
  107.     public function setUseragent(string $useragent): static
  108.     {
  109.         $this->useragent $useragent;
  110.         return $this;
  111.     }
  112.     public function getDate(): ?\DateTimeInterface
  113.     {
  114.         return $this->date;
  115.     }
  116.     public function setDate(\DateTimeInterface $date): static
  117.     {
  118.         $this->date $date;
  119.         return $this;
  120.     }
  121.     public function getUsed(): ?\DateTimeInterface
  122.     {
  123.         return $this->used;
  124.     }
  125.     public function setUsed(?\DateTimeInterface $used): static
  126.     {
  127.         $this->used $used;
  128.         return $this;
  129.     }
  130. }