src/Entity/Contact.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ContactRepository;
  4. use App\Validator\PhoneNumber;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Component\Validator\Constraints as Assert;
  9. /**
  10.  * @ORM\Entity(repositoryClass=ContactRepository::class)
  11.  */
  12. class Contact
  13. {
  14.     public function __toString()
  15.     {
  16.         return "#" $this->id;
  17.     }
  18.     /**
  19.      * @ORM\Column(name="createdAt", type="datetime", nullable=true)
  20.      */
  21.     private $createdAt;
  22.     /**
  23.      * @ORM\Id
  24.      * @ORM\GeneratedValue
  25.      * @ORM\Column(type="integer")
  26.      */
  27.     private $id;
  28.     /**
  29.      * @ORM\Column(type="string", length=255, nullable=true)
  30.      */
  31.     private $firstname;
  32.     /**
  33.      * @ORM\Column(type="string", length=255, nullable=true)
  34.      */
  35.     private $lastname;
  36.     /**
  37.      * @Assert\Email()
  38.      * @ORM\Column(type="string", length=255, nullable=true)
  39.      */
  40.     private $email;
  41.     /**
  42.      * @ORM\Column(type="string", length=255, nullable=true)
  43.      */
  44.     private $phoneNumber;
  45.     /**
  46.      * @ORM\Column(type="string", length=255, nullable=true)
  47.      */
  48.     private $subject;
  49.     /**
  50.      * @ORM\Column(type="text", nullable=true)
  51.      */
  52.     private $message;
  53.     /**
  54.      * @ORM\OneToMany(targetEntity=CustomFile::class, mappedBy="contact", cascade={"persist"})
  55.      */
  56.     private $customFiles;
  57.     /**
  58.      * @ORM\Column(type="string", length=255, nullable=true)
  59.      */
  60.     private $society;
  61.     /**
  62.      * @ORM\Column(type="string", length=255, nullable=true)
  63.      */
  64.     private $country;
  65.     public function __construct()
  66.     {
  67.         $this->customFiles = new ArrayCollection();
  68.         $this->createdAt = new \DateTime();
  69.     }
  70.     public function getId(): ?int
  71.     {
  72.         return $this->id;
  73.     }
  74.     public function getFirstname(): ?string
  75.     {
  76.         return $this->firstname;
  77.     }
  78.     public function setFirstname(?string $firstname): self
  79.     {
  80.         $this->firstname $firstname;
  81.         return $this;
  82.     }
  83.     public function getLastname(): ?string
  84.     {
  85.         return $this->lastname;
  86.     }
  87.     public function setLastname(?string $lastname): self
  88.     {
  89.         $this->lastname $lastname;
  90.         return $this;
  91.     }
  92.     public function getEmail(): ?string
  93.     {
  94.         return $this->email;
  95.     }
  96.     public function setEmail(?string $email): self
  97.     {
  98.         $this->email $email;
  99.         return $this;
  100.     }
  101.     public function getPhoneNumber(): ?string
  102.     {
  103.         return $this->phoneNumber;
  104.     }
  105.     public function setPhoneNumber(?string $phoneNumber): self
  106.     {
  107.         $this->phoneNumber $phoneNumber;
  108.         return $this;
  109.     }
  110.     public function getSubject(): ?string
  111.     {
  112.         return $this->subject;
  113.     }
  114.     public function setSubject(?string $subject): self
  115.     {
  116.         $this->subject $subject;
  117.         return $this;
  118.     }
  119.     public function getMessage(): ?string
  120.     {
  121.         return $this->message;
  122.     }
  123.     public function setMessage(?string $message): self
  124.     {
  125.         $this->message $message;
  126.         return $this;
  127.     }
  128.     /**
  129.      * @return Collection<int, CustomFile>
  130.      */
  131.     public function getCustomFiles(): Collection
  132.     {
  133.         return $this->customFiles;
  134.     }
  135.     public function addCustomFile(CustomFile $customFile): self
  136.     {
  137.         if (!$this->customFiles->contains($customFile)) {
  138.             $this->customFiles[] = $customFile;
  139.             $customFile->setContact($this);
  140.         }
  141.         return $this;
  142.     }
  143.     public function removeCustomFile(CustomFile $customFile): self
  144.     {
  145.         if ($this->customFiles->removeElement($customFile)) {
  146.             // set the owning side to null (unless already changed)
  147.             if ($customFile->getContact() === $this) {
  148.                 $customFile->setContact(null);
  149.             }
  150.         }
  151.         return $this;
  152.     }
  153.     public function getCreatedAt(): ?\DateTimeInterface
  154.     {
  155.         return $this->createdAt;
  156.     }
  157.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  158.     {
  159.         $this->createdAt $createdAt;
  160.         return $this;
  161.     }
  162.     public function getSociety(): ?string
  163.     {
  164.         return $this->society;
  165.     }
  166.     public function setSociety(?string $society): self
  167.     {
  168.         $this->society $society;
  169.         return $this;
  170.     }
  171.     public function getCountry(): ?string
  172.     {
  173.         return $this->country;
  174.     }
  175.     public function setCountry(?string $country): self
  176.     {
  177.         $this->country $country;
  178.         return $this;
  179.     }
  180. }