src/Entity/Contact.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ContactRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Validator\Constraints as Assert;
  8. use App\Validator as CustomAssert;
  9. /**
  10.  * @ORM\Entity(repositoryClass=ContactRepository::class)
  11.  */
  12. class Contact
  13. {
  14.     /**
  15.      * @ORM\Id
  16.      * @ORM\GeneratedValue
  17.      * @ORM\Column(type="integer")
  18.      */
  19.     private $id;
  20.     /**
  21.      * @ORM\Column(type="text")
  22.      * @Assert\NotBlank
  23.      * @Assert\Length(max=255)
  24.      */
  25.     private $subject;
  26.     /**
  27.      * @ORM\Column(type="string", length=255)
  28.      * @Assert\NotBlank
  29.      * @CustomAssert\Url
  30.      * @Assert\Length(max=245)
  31.      */
  32.     private $url;
  33.     /**
  34.      * @ORM\Column(type="string", length=255)
  35.      * @Assert\NotBlank
  36.      * @Assert\Regex(
  37.      *     pattern = "/^([\p{L}])*(?: ([\p{L}])+)*$/u",
  38.      *     htmlPattern = false,
  39.      *     message = "The name must contain only letters and spaces."
  40.      * )
  41.      * @Assert\Length(max=255)
  42.      */
  43.     private $name;
  44.     /**
  45.      * @ORM\Column(type="string", length=255, nullable=true)
  46.      * @Assert\Length(max=255)
  47.      */
  48.     private $company;
  49.     /**
  50.      * @ORM\Column(type="string", length=255)
  51.      * @CustomAssert\Email
  52.      * @Assert\NotBlank
  53.      * @Assert\Length(max=255)
  54.      */
  55.     private $email;
  56.     /**
  57.      * @ORM\Column(type="string", length=255, nullable=true)
  58.      * @Assert\NotBlank
  59.      * @CustomAssert\Telephone
  60.      * @Assert\Length(max=255)
  61.      */
  62.     private $phone;
  63.     /**
  64.      * @ORM\Column(type="string", length=255)
  65.      * @Assert\NotBlank
  66.      * @Assert\Length(max=255)
  67.      */
  68.     private $hear;
  69.     /**
  70.      * @ORM\Column(type="string", length=255)
  71.      */
  72.     private $ip;
  73.     /**
  74.      * @ORM\Column(type="datetime", nullable=false)
  75.      */
  76.     private $createdAt;
  77.     /**
  78.      * @ORM\ManyToOne(targetEntity=Countries::class, inversedBy="contacts")
  79.      * @Assert\NotBlank
  80.      */
  81.     private $country;
  82.     /**
  83.      * @ORM\OneToOne(targetEntity=AdditionalForm::class, mappedBy="contact")
  84.      */
  85.     private $additionalForm;
  86.     public function getId(): ?int
  87.     {
  88.         return $this->id;
  89.     }
  90.     public function getSubject(): ?string
  91.     {
  92.         return $this->subject;
  93.     }
  94.     public function setSubject(string $subject): self
  95.     {
  96.         $this->subject $subject;
  97.         return $this;
  98.     }
  99.     public function getUrl(): ?string
  100.     {
  101.         return $this->url;
  102.     }
  103.     public function setUrl(string $url): self
  104.     {
  105.         $this->url $url;
  106.         return $this;
  107.     }
  108.     public function getName(): ?string
  109.     {
  110.         return $this->name;
  111.     }
  112.     public function setName(string $name): self
  113.     {
  114.         $this->name $name;
  115.         return $this;
  116.     }
  117.     public function getCompany(): ?string
  118.     {
  119.         return $this->company;
  120.     }
  121.     public function setCompany(?string $company): self
  122.     {
  123.         $this->company $company;
  124.         return $this;
  125.     }
  126.     public function getEmail(): ?string
  127.     {
  128.         return $this->email;
  129.     }
  130.     public function setEmail(string $email): self
  131.     {
  132.         $this->email $email;
  133.         return $this;
  134.     }
  135.     public function getPhone(): ?string
  136.     {
  137.         return $this->phone;
  138.     }
  139.     public function setPhone(?string $phone): self
  140.     {
  141.         $this->phone $phone;
  142.         return $this;
  143.     }
  144.     public function getHear(): ?string
  145.     {
  146.         return $this->hear;
  147.     }
  148.     public function setHear(string $hear): self
  149.     {
  150.         $this->hear $hear;
  151.         return $this;
  152.     }
  153.     public function getIp(): ?string
  154.     {
  155.         return $this->ip;
  156.     }
  157.     public function setIp(string $ip): self
  158.     {
  159.         $this->ip $ip;
  160.         return $this;
  161.     }
  162.     public function getCreatedAt(): ?\DateTimeInterface
  163.     {
  164.         return $this->createdAt;
  165.     }
  166.     public function setCreatedAt(?\DateTimeInterface $createdAt): self
  167.     {
  168.         $this->createdAt $createdAt;
  169.         return $this;
  170.     }
  171.     public function getCountry(): ?Countries
  172.     {
  173.         return $this->country;
  174.     }
  175.     public function setCountry(?Countries $country): self
  176.     {
  177.         $this->country $country;
  178.         return $this;
  179.     }
  180.     public function getAdditionalForm(): ?AdditionalForm
  181.     {
  182.         return $this->additionalForm;
  183.     }
  184.     public function setAdditionalForm(AdditionalForm $additionalForm): self
  185.     {
  186.         // set the owning side of the relation if necessary
  187.         if ($additionalForm->getContact() !== $this) {
  188.             $additionalForm->setContact($this);
  189.         }
  190.         $this->additionalForm $additionalForm;
  191.         return $this;
  192.     }
  193. }