src/Entity/Gos/SmsCode.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Gos;
  3. use App\Repository\Gos\SmsCodeRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Component\Validator\Constraints as Assert;
  6. /**
  7.  * @ORM\Entity(repositoryClass=SmsCodeRepository::class)
  8.  * @ORM\HasLifecycleCallbacks()
  9.  */
  10. class SmsCode
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="smsCodes")
  20.      * @ORM\JoinColumn(nullable=false)
  21.      */
  22.     private $user;
  23.     /**
  24.      * @ORM\Column(type="string", length=30)
  25.      * @Assert\Length(max = 30)
  26.      */
  27.     private $phoneNumber;
  28.     /**
  29.      * @ORM\Column(type="integer")
  30.      */
  31.     private $code;
  32.     /**
  33.      * @ORM\Column(type="datetime")
  34.      */
  35.     private $createdAt;
  36.     /** @ORM\PrePersist() */
  37.     public function prePersist()
  38.     {
  39.         $this->createdAt = new \DateTime();
  40.     }
  41.     public function getId(): ?int
  42.     {
  43.         return $this->id;
  44.     }
  45.     public function getUser(): ?User
  46.     {
  47.         return $this->user;
  48.     }
  49.     public function setUser(?User $user): self
  50.     {
  51.         $this->user $user;
  52.         return $this;
  53.     }
  54.     public function getPhoneNumber(): ?string
  55.     {
  56.         return $this->phoneNumber;
  57.     }
  58.     public function setPhoneNumber(string $phoneNumber): self
  59.     {
  60.         $this->phoneNumber $phoneNumber;
  61.         return $this;
  62.     }
  63.     public function getCode(): ?int
  64.     {
  65.         return $this->code;
  66.     }
  67.     public function setCode(int $code): self
  68.     {
  69.         $this->code $code;
  70.         return $this;
  71.     }
  72.     public function getCreatedAt(): ?\DateTimeInterface
  73.     {
  74.         return $this->createdAt;
  75.     }
  76.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  77.     {
  78.         $this->createdAt $createdAt;
  79.         return $this;
  80.     }
  81. }