<?php
namespace App\Entity;
use App\Annotations\Xss\XssAware;
use App\Annotations\Xss\XssProperty;
use App\Component\GDPR\Annotation as GDPR;
use App\Component\GDPR\Entity\AnonymizedTrait;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* Contact.
*
* @ORM\Table(name="contact")
* @ORM\Entity(repositoryClass="App\Entity\Repository\ContactRepository")
* @XssAware
*/
class Contact
{
use AnonymizedTrait;
use SiteAwareTrait;
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="first_name", type="string", length=170)
* @GDPR\Anonymize(type="fixed", value="anonymized")
* @XssProperty
*/
#[Assert\NotBlank]
private $firstName;
/**
* @var string
*
* @ORM\Column(name="last_name", type="string", length=170, nullable=true)
* @GDPR\Anonymize(type="fixed", value="anonymized")
* @XssProperty
*/
private $lastName;
/**
* @var string
*
* @ORM\Column(name="company", type="string", length=170, nullable=true)
* @GDPR\Anonymize(type="null")
* @XssProperty
*/
private $company;
/**
* @var PhoneNumber|null
* @ORM\Column(name="phone", type="phone_number", nullable=true)
* @GDPR\Anonymize(type="null")
*/
private $phone;
/**
* @var string
*
* @ORM\Column(name="email", type="string", length=170)
* @GDPR\Anonymize(type="fixed", value="anonymouse@email.tld")
*/
#[Assert\NotBlank]
#[Assert\Email]
private $email;
/**
* @var string
*
* @ORM\Column(name="remark", type="text", nullable=false)
* @GDPR\Anonymize(type="fixed", value="anonymized")
* @XssProperty
*/
#[Assert\NotBlank]
private $remark;
/**
* @ORM\Column(type="datetime")
*
* @var \DateTime
*/
private $createdAt;
/**
* @var string|null
*
* @ORM\Column(type="string", length=6, nullable=true)
*/
private $locale;
/**
* @var string|null
*
* @ORM\Column(name="origin", type="string", length=170, nullable=true)
* @GDPR\Anonymize(type="null")
*/
protected $origin;
/**
* @var Company
*
* @ORM\ManyToOne(targetEntity="App\Entity\Company")
*/
protected $contactedCompany;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @GDPR\Anonymize(type="null")
* @XssProperty
*/
private $address;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @GDPR\Anonymize(type="null")
* @XssProperty
*/
private $zipCode;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @GDPR\Anonymize(type="null")
* @XssProperty
*/
private $city;
public function __construct()
{
if (null === $this->getCreatedAt()) {
$this->setCreatedAt(new \DateTime('now'));
}
}
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 getCompany(): ?string
{
return $this->company;
}
public function setCompany(?string $company): self
{
$this->company = $company;
return $this;
}
public function getPhone(): ?PhoneNumber
{
return $this->phone;
}
public function setPhone(?PhoneNumber $phone): self
{
$this->phone = $phone;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(string $email): self
{
$this->email = $email;
return $this;
}
public function getRemark(): ?string
{
return $this->remark;
}
public function setRemark(string $remark): self
{
$this->remark = $remark;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getLocale(): ?string
{
return $this->locale;
}
public function setLocale(?string $locale): self
{
$this->locale = $locale;
return $this;
}
public function getOrigin(): ?string
{
return $this->origin;
}
public function setOrigin(?string $origin): self
{
$this->origin = $origin;
return $this;
}
public function getContactedCompany(): ?Company
{
return $this->contactedCompany;
}
public function setContactedCompany(?Company $contactedCompany): self
{
$this->contactedCompany = $contactedCompany;
return $this;
}
public function getAddress(): ?string
{
return $this->address;
}
public function setAddress(?string $address): self
{
$this->address = $address;
return $this;
}
public function getZipCode(): ?string
{
return $this->zipCode;
}
public function setZipCode(?string $zipCode): self
{
$this->zipCode = $zipCode;
return $this;
}
public function getCity(): ?string
{
return $this->city;
}
public function setCity(?string $city): self
{
$this->city = $city;
return $this;
}
}