src/Entity/Contact.php line 11

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ContactRepository;
  4. use Doctrine\DBAL\Types\Types;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Component\Validator\Constraints as Assert;
  7. #[ORM\Entity(repositoryClassContactRepository::class)]
  8. class Contact
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column]
  13.     private ?int $id null;
  14.     #[ORM\Column(length255)]
  15.     #[Assert\NotBlank(
  16.         message 'Le prénom ne peut pas être vide.'
  17.     )]
  18.     private ?string $firstName null;
  19.     #[ORM\Column(length255)]
  20.     #[Assert\NotBlank(
  21.         message 'Le nom ne peut pas être vide.'
  22.     )]
  23.     private ?string $lastName null
  24.     #[ORM\Column(length255)]
  25.     #[Assert\NotBlank]
  26.     #[Assert\Email(
  27.         message'L\'email ne peut pas être vide.',
  28.     )]
  29.     private ?string $email null;
  30.     #[ORM\Column(typeTypes::TEXT)]
  31.     #[Assert\Length(
  32.         min2,
  33.         max100,
  34.         minMessage'Votre message est trop court',
  35.         maxMessage'votre message est trop long',
  36.     )]
  37.     private ?string $message null;
  38.     #[ORM\Column(length255)]
  39.     private ?string $object null;
  40.     #[ORM\Column(length10nullabletrue)]
  41.     #[Assert\NotBlank(
  42.         message 'Le numéro de téléphone ne peut pas être vide.'
  43.     )]
  44.     #[Assert\Regex('^(?:(?:\+|00)33[\s.-]{0,3}(?:\(0\)[\s.-]{0,3})?|0)[1-9](?:(?:[\s.-]?\d{2}){4}|\d{2}(?:[\s.-]?\d{3}){2})$^
  45.     ',
  46.     message "Veuillez renseigner un numéro de téléphone français fixe"
  47.     )]
  48.     private ?string $phone null;
  49.     public function getId(): ?int
  50.     {
  51.         return $this->id;
  52.     }
  53.     public function getFirstName(): ?string
  54.     {
  55.         return $this->firstName;
  56.     }
  57.     public function setFirstName(string $firstName): self
  58.     {
  59.         $this->firstName $firstName;
  60.         return $this;
  61.     }
  62.     public function getLastName(): ?string
  63.     {
  64.         return $this->lastName;
  65.     }
  66.     public function setLastName(string $lastName): self
  67.     {
  68.         $this->lastName $lastName;
  69.         return $this;
  70.     }
  71.     public function getEmail(): ?string
  72.     {
  73.         return $this->email;
  74.     }
  75.     public function setEmail(string $email): self
  76.     {
  77.         $this->email $email;
  78.         return $this;
  79.     }
  80.     public function getMessage(): ?string
  81.     {
  82.         return $this->message;
  83.     }
  84.     public function setMessage(string $message): self
  85.     {
  86.         $this->message $message;
  87.         return $this;
  88.     }
  89.     public function getObject(): ?string
  90.     {
  91.         return $this->object;
  92.     }
  93.     public function setObject(string $object): self
  94.     {
  95.         $this->object $object;
  96.         return $this;
  97.     }
  98.     public function getPhone(): ?string
  99.     {
  100.         return $this->phone;
  101.     }
  102.     public function setPhone(?string $phone): self
  103.     {
  104.         $this->phone $phone;
  105.         return $this;
  106.     }
  107. }