<?php
namespace App\Entity;
use App\Repository\ContactRepository;
use App\Validator\PhoneNumber;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass=ContactRepository::class)
*/
class Contact
{
public function __toString()
{
return "#" . $this->id;
}
/**
* @ORM\Column(name="createdAt", type="datetime", nullable=true)
*/
private $createdAt;
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $firstname;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $lastname;
/**
* @Assert\Email()
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $email;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $phoneNumber;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $subject;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $message;
/**
* @ORM\OneToMany(targetEntity=CustomFile::class, mappedBy="contact", cascade={"persist"})
*/
private $customFiles;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $society;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $country;
public function __construct()
{
$this->customFiles = new ArrayCollection();
$this->createdAt = new \DateTime();
}
public function getId(): ?int
{
return $this->id;
}
public function getFirstname(): ?string
{
return $this->firstname;
}
public function setFirstname(?string $firstname): self
{
$this->firstname = $firstname;
return $this;
}
public function getLastname(): ?string
{
return $this->lastname;
}
public function setLastname(?string $lastname): self
{
$this->lastname = $lastname;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(?string $email): self
{
$this->email = $email;
return $this;
}
public function getPhoneNumber(): ?string
{
return $this->phoneNumber;
}
public function setPhoneNumber(?string $phoneNumber): self
{
$this->phoneNumber = $phoneNumber;
return $this;
}
public function getSubject(): ?string
{
return $this->subject;
}
public function setSubject(?string $subject): self
{
$this->subject = $subject;
return $this;
}
public function getMessage(): ?string
{
return $this->message;
}
public function setMessage(?string $message): self
{
$this->message = $message;
return $this;
}
/**
* @return Collection<int, CustomFile>
*/
public function getCustomFiles(): Collection
{
return $this->customFiles;
}
public function addCustomFile(CustomFile $customFile): self
{
if (!$this->customFiles->contains($customFile)) {
$this->customFiles[] = $customFile;
$customFile->setContact($this);
}
return $this;
}
public function removeCustomFile(CustomFile $customFile): self
{
if ($this->customFiles->removeElement($customFile)) {
// set the owning side to null (unless already changed)
if ($customFile->getContact() === $this) {
$customFile->setContact(null);
}
}
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getSociety(): ?string
{
return $this->society;
}
public function setSociety(?string $society): self
{
$this->society = $society;
return $this;
}
public function getCountry(): ?string
{
return $this->country;
}
public function setCountry(?string $country): self
{
$this->country = $country;
return $this;
}
}