src/Entity/Contact.php line 10

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ContactRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Component\Validator\Constraints as Assert;
  6. #[ORM\Entity(repositoryClassContactRepository::class)]
  7. class Contact
  8. {
  9.     #[ORM\Id]
  10.     #[ORM\GeneratedValue]
  11.     #[ORM\Column(type'integer')]
  12.     private int $id;
  13.     #[ORM\Column(type'string'length50)]
  14.     #[Assert\NotBlank()]
  15.     #[Assert\Length(min2)]
  16.     private string $name;
  17.     #[ORM\Column(type'string'length50)]
  18.     #[Assert\NotBlank()]
  19.     #[Assert\Email()]
  20.     private string $email;
  21.     #[ORM\Column(type'string'length20nullabletrue)]
  22.     #[Assert\Regex(
  23.         pattern'/[0-9]{10}/'
  24.     )]
  25.     private ?string $phone;
  26.     #[ORM\Column(type'string'length255)]
  27.     #[Assert\NotBlank()]
  28.     private string $subject;
  29.     #[ORM\Column(type'text')]
  30.     #[Assert\NotBlank()]
  31.     private string $message;
  32.     #[ORM\Column(type'datetime')]
  33.     private \DateTime $send_at;
  34.     public function __construct()
  35.     {
  36.         $this->phone null;
  37.     }
  38.     public function getId(): ?int
  39.     {
  40.         return $this->id;
  41.     }
  42.     public function getName(): ?string
  43.     {
  44.         return $this->name;
  45.     }
  46.     public function setName(string $name): self
  47.     {
  48.         $this->name $name;
  49.         return $this;
  50.     }
  51.     public function getEmail(): ?string
  52.     {
  53.         return $this->email;
  54.     }
  55.     public function setEmail(string $email): self
  56.     {
  57.         $this->email $email;
  58.         return $this;
  59.     }
  60.     public function getPhone(): ?string
  61.     {
  62.         return $this->phone;
  63.     }
  64.     public function setPhone(string $phone): self
  65.     {
  66.         $this->phone $phone;
  67.         return $this;
  68.     }
  69.     public function getSubject(): ?string
  70.     {
  71.         return $this->subject;
  72.     }
  73.     public function setSubject(string $subject): self
  74.     {
  75.         $this->subject $subject;
  76.         return $this;
  77.     }
  78.     public function getMessage(): ?string
  79.     {
  80.         return $this->message;
  81.     }
  82.     public function setMessage(string $message): self
  83.     {
  84.         $this->message $message;
  85.         return $this;
  86.     }
  87.     public function getSendAt(): ?\DateTime
  88.     {
  89.         return $this->send_at;
  90.     }
  91.     public function setSendAt(\DateTime $send_at): self
  92.     {
  93.         $this->send_at $send_at;
  94.         return $this;
  95.     }
  96. }