<?php
namespace App\Entity\Vetoadom;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* SecteurTexteMail
*
* @ORM\Table(name="secteur_texte_mail", indexes={@ORM\Index(name="FK_secteur_texte_mail_secteur_texte_mail_type", columns={"secteur_texte_mail_type_id"}), @ORM\Index(name="FK_secteur_texte_mail_secteur", columns={"secteur_id"})})
* @ORM\Entity(repositoryClass="App\Repository\Vetoadom\SecteurTexteMailRepository")
* @ORM\HasLifecycleCallbacks()
*/
class SecteurTexteMail
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="objet", type="string", length=190, nullable=false)
* @Assert\NotBlank(
* groups={"objet"},
* message="common.blank"
* )
* @Assert\Length(
* groups={"objet"},
* max=190,
* maxMessage="common.too_long"
* )
*/
private $objet;
/**
* @var string
*
* @ORM\Column(name="corps", type="text", length=65535, nullable=false)
* @Assert\NotBlank(
* normalizer="App\Entity\Vetoadom\SecteurTexteMail::cleanMessage",
* groups={"corps"},
* message="common.blank"
* )
* @Assert\Length(
* groups={"corps"},
* max=65535,
* maxMessage="common.too_long"
* )
*/
private $corps;
/**
* @var \DateTime
*
* @ORM\Column(name="date_creation", type="datetime", nullable=false)
*/
private $dateCreation;
/**
* @var \DateTime
*
* @ORM\Column(name="date_modification", type="datetime", nullable=false, options={"default"="CURRENT_TIMESTAMP"})
*/
private $dateModification;
/**
* @var \Secteur
*
* @ORM\ManyToOne(targetEntity="Secteur", inversedBy="secteurTexteMail")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="secteur_id", referencedColumnName="id")
* })
*/
private $secteur;
/**
* @var \SecteurTexteMailType
*
* @ORM\ManyToOne(targetEntity="SecteurTexteMailType")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="secteur_texte_mail_type_id", referencedColumnName="id")
* })
* @Assert\NotBlank(
* groups={"secteurTexteMailType"},
* message="common.blank"
* )
*/
private $secteurTexteMailType;
public function getId(): ?int
{
return $this->id;
}
public function getObjet(): ?string
{
return $this->objet;
}
public function setObjet(string $objet): self
{
$this->objet = $objet;
return $this;
}
public function getCorps(): ?string
{
return $this->corps;
}
public function setCorps(string $corps): self
{
$this->corps = $corps;
return $this;
}
public function getDateCreation(): ?\DateTimeInterface
{
return $this->dateCreation;
}
public function setDateCreation(\DateTimeInterface $dateCreation): self
{
$this->dateCreation = $dateCreation;
return $this;
}
public function getDateModification(): ?\DateTimeInterface
{
return $this->dateModification;
}
public function setDateModification(\DateTimeInterface $dateModification): self
{
$this->dateModification = $dateModification;
return $this;
}
public function getSecteur(): ?Secteur
{
return $this->secteur;
}
public function setSecteur(?Secteur $secteur): self
{
$this->secteur = $secteur;
return $this;
}
public function getSecteurTexteMailType(): ?SecteurTexteMailType
{
return $this->secteurTexteMailType;
}
public function setSecteurTexteMailType(?SecteurTexteMailType $secteurTexteMailType): self
{
$this->secteurTexteMailType = $secteurTexteMailType;
return $this;
}
/**
* @ORM\PrePersist
*/
public function setCreatedAtValue()
{
$this->dateCreation = new \DateTimeImmutable();
}
/**
* Helpers
*/
public function cleanMessage($message)
{
return trim(html_entity_decode(str_replace(' ','',strip_tags($message)),ENT_COMPAT,'UTF-8'));
}
}