<?php
namespace App\Entity;
use App\Repository\ContactRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use App\Validator as CustomAssert;
/**
* @ORM\Entity(repositoryClass=ContactRepository::class)
*/
class Contact
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="text")
* @Assert\NotBlank
* @Assert\Length(max=255)
*/
private $subject;
/**
* @ORM\Column(type="string", length=255)
* @Assert\NotBlank
* @CustomAssert\Url
* @Assert\Length(max=245)
*/
private $url;
/**
* @ORM\Column(type="string", length=255)
* @Assert\NotBlank
* @Assert\Regex(
* pattern = "/^([\p{L}])*(?: ([\p{L}])+)*$/u",
* htmlPattern = false,
* message = "The name must contain only letters and spaces."
* )
* @Assert\Length(max=255)
*/
private $name;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Assert\Length(max=255)
*/
private $company;
/**
* @ORM\Column(type="string", length=255)
* @CustomAssert\Email
* @Assert\NotBlank
* @Assert\Length(max=255)
*/
private $email;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Assert\NotBlank
* @CustomAssert\Telephone
* @Assert\Length(max=255)
*/
private $phone;
/**
* @ORM\Column(type="string", length=255)
* @Assert\NotBlank
* @Assert\Length(max=255)
*/
private $hear;
/**
* @ORM\Column(type="string", length=255)
*/
private $ip;
/**
* @ORM\Column(type="datetime", nullable=false)
*/
private $createdAt;
/**
* @ORM\ManyToOne(targetEntity=Countries::class, inversedBy="contacts")
* @Assert\NotBlank
*/
private $country;
/**
* @ORM\OneToOne(targetEntity=AdditionalForm::class, mappedBy="contact")
*/
private $additionalForm;
public function getId(): ?int
{
return $this->id;
}
public function getSubject(): ?string
{
return $this->subject;
}
public function setSubject(string $subject): self
{
$this->subject = $subject;
return $this;
}
public function getUrl(): ?string
{
return $this->url;
}
public function setUrl(string $url): self
{
$this->url = $url;
return $this;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getCompany(): ?string
{
return $this->company;
}
public function setCompany(?string $company): self
{
$this->company = $company;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(string $email): self
{
$this->email = $email;
return $this;
}
public function getPhone(): ?string
{
return $this->phone;
}
public function setPhone(?string $phone): self
{
$this->phone = $phone;
return $this;
}
public function getHear(): ?string
{
return $this->hear;
}
public function setHear(string $hear): self
{
$this->hear = $hear;
return $this;
}
public function getIp(): ?string
{
return $this->ip;
}
public function setIp(string $ip): self
{
$this->ip = $ip;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(?\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getCountry(): ?Countries
{
return $this->country;
}
public function setCountry(?Countries $country): self
{
$this->country = $country;
return $this;
}
public function getAdditionalForm(): ?AdditionalForm
{
return $this->additionalForm;
}
public function setAdditionalForm(AdditionalForm $additionalForm): self
{
// set the owning side of the relation if necessary
if ($additionalForm->getContact() !== $this) {
$additionalForm->setContact($this);
}
$this->additionalForm = $additionalForm;
return $this;
}
}