src/Entity/Contact.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Annotations\Xss\XssAware;
  4. use App\Annotations\Xss\XssProperty;
  5. use App\Component\GDPR\Annotation as GDPR;
  6. use App\Component\GDPR\Entity\AnonymizedTrait;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Component\Validator\Constraints as Assert;
  9. /**
  10.  * Contact.
  11.  *
  12.  * @ORM\Table(name="contact")
  13.  * @ORM\Entity(repositoryClass="App\Entity\Repository\ContactRepository")
  14.  * @XssAware
  15.  */
  16. class Contact
  17. {
  18.     use AnonymizedTrait;
  19.     use SiteAwareTrait;
  20.     /**
  21.      * @var int
  22.      *
  23.      * @ORM\Column(name="id", type="integer")
  24.      * @ORM\Id
  25.      * @ORM\GeneratedValue(strategy="AUTO")
  26.      */
  27.     private $id;
  28.     /**
  29.      * @var string
  30.      *
  31.      * @ORM\Column(name="first_name", type="string", length=170)
  32.      * @GDPR\Anonymize(type="fixed", value="anonymized")
  33.      * @XssProperty
  34.      */
  35.     #[Assert\NotBlank]
  36.     private $firstName;
  37.     /**
  38.      * @var string
  39.      *
  40.      * @ORM\Column(name="last_name", type="string", length=170, nullable=true)
  41.      * @GDPR\Anonymize(type="fixed", value="anonymized")
  42.      * @XssProperty
  43.      */
  44.     private $lastName;
  45.     /**
  46.      * @var string
  47.      *
  48.      * @ORM\Column(name="company", type="string", length=170, nullable=true)
  49.      * @GDPR\Anonymize(type="null")
  50.      * @XssProperty
  51.      */
  52.     private $company;
  53.     /**
  54.      * @var PhoneNumber|null
  55.      * @ORM\Column(name="phone", type="phone_number", nullable=true)
  56.      * @GDPR\Anonymize(type="null")
  57.      */
  58.     private $phone;
  59.     /**
  60.      * @var string
  61.      *
  62.      * @ORM\Column(name="email", type="string", length=170)
  63.      * @GDPR\Anonymize(type="fixed", value="anonymouse@email.tld")
  64.      */
  65.     #[Assert\NotBlank]
  66.     #[Assert\Email]
  67.     private $email;
  68.     /**
  69.      * @var string
  70.      *
  71.      * @ORM\Column(name="remark", type="text", nullable=false)
  72.      * @GDPR\Anonymize(type="fixed", value="anonymized")
  73.      * @XssProperty
  74.      */
  75.     #[Assert\NotBlank]
  76.     private $remark;
  77.     /**
  78.      * @ORM\Column(type="datetime")
  79.      *
  80.      * @var \DateTime
  81.      */
  82.     private $createdAt;
  83.     /**
  84.      * @var string|null
  85.      *
  86.      * @ORM\Column(type="string", length=6, nullable=true)
  87.      */
  88.     private $locale;
  89.     /**
  90.      * @var string|null
  91.      *
  92.      * @ORM\Column(name="origin", type="string", length=170, nullable=true)
  93.      * @GDPR\Anonymize(type="null")
  94.      */
  95.     protected $origin;
  96.     /**
  97.      * @var Company
  98.      *
  99.      * @ORM\ManyToOne(targetEntity="App\Entity\Company")
  100.      */
  101.     protected $contactedCompany;
  102.     /**
  103.      * @ORM\Column(type="string", length=255, nullable=true)
  104.      * @GDPR\Anonymize(type="null")
  105.      * @XssProperty
  106.      */
  107.     private $address;
  108.     /**
  109.      * @ORM\Column(type="string", length=255, nullable=true)
  110.      * @GDPR\Anonymize(type="null")
  111.      * @XssProperty
  112.      */
  113.     private $zipCode;
  114.     /**
  115.      * @ORM\Column(type="string", length=255, nullable=true)
  116.      * @GDPR\Anonymize(type="null")
  117.      * @XssProperty
  118.      */
  119.     private $city;
  120.     public function __construct()
  121.     {
  122.         if (null === $this->getCreatedAt()) {
  123.             $this->setCreatedAt(new \DateTime('now'));
  124.         }
  125.     }
  126.     public function getId(): ?int
  127.     {
  128.         return $this->id;
  129.     }
  130.     public function getFirstName(): ?string
  131.     {
  132.         return $this->firstName;
  133.     }
  134.     public function setFirstName(string $firstName): self
  135.     {
  136.         $this->firstName $firstName;
  137.         return $this;
  138.     }
  139.     public function getLastName(): ?string
  140.     {
  141.         return $this->lastName;
  142.     }
  143.     public function setLastName(?string $lastName): self
  144.     {
  145.         $this->lastName $lastName;
  146.         return $this;
  147.     }
  148.     public function getCompany(): ?string
  149.     {
  150.         return $this->company;
  151.     }
  152.     public function setCompany(?string $company): self
  153.     {
  154.         $this->company $company;
  155.         return $this;
  156.     }
  157.     public function getPhone(): ?PhoneNumber
  158.     {
  159.         return $this->phone;
  160.     }
  161.     public function setPhone(?PhoneNumber $phone): self
  162.     {
  163.         $this->phone $phone;
  164.         return $this;
  165.     }
  166.     public function getEmail(): ?string
  167.     {
  168.         return $this->email;
  169.     }
  170.     public function setEmail(string $email): self
  171.     {
  172.         $this->email $email;
  173.         return $this;
  174.     }
  175.     public function getRemark(): ?string
  176.     {
  177.         return $this->remark;
  178.     }
  179.     public function setRemark(string $remark): self
  180.     {
  181.         $this->remark $remark;
  182.         return $this;
  183.     }
  184.     public function getCreatedAt(): ?\DateTimeInterface
  185.     {
  186.         return $this->createdAt;
  187.     }
  188.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  189.     {
  190.         $this->createdAt $createdAt;
  191.         return $this;
  192.     }
  193.     public function getLocale(): ?string
  194.     {
  195.         return $this->locale;
  196.     }
  197.     public function setLocale(?string $locale): self
  198.     {
  199.         $this->locale $locale;
  200.         return $this;
  201.     }
  202.     public function getOrigin(): ?string
  203.     {
  204.         return $this->origin;
  205.     }
  206.     public function setOrigin(?string $origin): self
  207.     {
  208.         $this->origin $origin;
  209.         return $this;
  210.     }
  211.     public function getContactedCompany(): ?Company
  212.     {
  213.         return $this->contactedCompany;
  214.     }
  215.     public function setContactedCompany(?Company $contactedCompany): self
  216.     {
  217.         $this->contactedCompany $contactedCompany;
  218.         return $this;
  219.     }
  220.     public function getAddress(): ?string
  221.     {
  222.         return $this->address;
  223.     }
  224.     public function setAddress(?string $address): self
  225.     {
  226.         $this->address $address;
  227.         return $this;
  228.     }
  229.     public function getZipCode(): ?string
  230.     {
  231.         return $this->zipCode;
  232.     }
  233.     public function setZipCode(?string $zipCode): self
  234.     {
  235.         $this->zipCode $zipCode;
  236.         return $this;
  237.     }
  238.     public function getCity(): ?string
  239.     {
  240.         return $this->city;
  241.     }
  242.     public function setCity(?string $city): self
  243.     {
  244.         $this->city $city;
  245.         return $this;
  246.     }
  247. }