src/Entity/Vetoadom/SecteurTexteMail.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Vetoadom;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Symfony\Component\Validator\Constraints as Assert;
  5. /**
  6.  * SecteurTexteMail
  7.  *
  8.  * @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"})})
  9.  * @ORM\Entity(repositoryClass="App\Repository\Vetoadom\SecteurTexteMailRepository")
  10.  * @ORM\HasLifecycleCallbacks()
  11.  */
  12. class SecteurTexteMail
  13. {
  14.     /**
  15.      * @var int
  16.      *
  17.      * @ORM\Column(name="id", type="integer", nullable=false)
  18.      * @ORM\Id
  19.      * @ORM\GeneratedValue(strategy="IDENTITY")
  20.      */
  21.     private $id;
  22.     /**
  23.      * @var string
  24.      *
  25.      * @ORM\Column(name="objet", type="string", length=190, nullable=false)
  26.      * @Assert\NotBlank(
  27.      *        groups={"objet"},
  28.      *        message="common.blank"
  29.      *     )
  30.      * @Assert\Length(
  31.      *        groups={"objet"},
  32.      *        max=190,
  33.      *        maxMessage="common.too_long"
  34.      *     )
  35.      */
  36.     private $objet;
  37.     /**
  38.      * @var string
  39.      *
  40.      * @ORM\Column(name="corps", type="text", length=65535, nullable=false)
  41.      * @Assert\NotBlank(
  42.      *        normalizer="App\Entity\Vetoadom\SecteurTexteMail::cleanMessage",
  43.      *        groups={"corps"},
  44.      *        message="common.blank"
  45.      *     )
  46.      * @Assert\Length(
  47.      *        groups={"corps"},
  48.      *        max=65535,
  49.      *        maxMessage="common.too_long"
  50.      *     )
  51.      */
  52.     private $corps;
  53.     /**
  54.      * @var \DateTime
  55.      *
  56.      * @ORM\Column(name="date_creation", type="datetime", nullable=false)
  57.      */
  58.     private $dateCreation;
  59.     /**
  60.      * @var \DateTime
  61.      *
  62.      * @ORM\Column(name="date_modification", type="datetime", nullable=false, options={"default"="CURRENT_TIMESTAMP"})
  63.      */
  64.     private $dateModification;
  65.     /**
  66.      * @var \Secteur
  67.      *
  68.      * @ORM\ManyToOne(targetEntity="Secteur", inversedBy="secteurTexteMail")
  69.      * @ORM\JoinColumns({
  70.      *   @ORM\JoinColumn(name="secteur_id", referencedColumnName="id")
  71.      * })
  72.      */
  73.     private $secteur;
  74.     /**
  75.      * @var \SecteurTexteMailType
  76.      *
  77.      * @ORM\ManyToOne(targetEntity="SecteurTexteMailType")
  78.      * @ORM\JoinColumns({
  79.      *   @ORM\JoinColumn(name="secteur_texte_mail_type_id", referencedColumnName="id")
  80.      * })
  81.      * @Assert\NotBlank(
  82.      *         groups={"secteurTexteMailType"},
  83.      *         message="common.blank"
  84.      *      )
  85.      */
  86.     private $secteurTexteMailType;
  87.     public function getId(): ?int
  88.     {
  89.         return $this->id;
  90.     }
  91.     public function getObjet(): ?string
  92.     {
  93.         return $this->objet;
  94.     }
  95.     public function setObjet(string $objet): self
  96.     {
  97.         $this->objet $objet;
  98.         return $this;
  99.     }
  100.     public function getCorps(): ?string
  101.     {
  102.         return $this->corps;
  103.     }
  104.     public function setCorps(string $corps): self
  105.     {
  106.         $this->corps $corps;
  107.         return $this;
  108.     }
  109.     public function getDateCreation(): ?\DateTimeInterface
  110.     {
  111.         return $this->dateCreation;
  112.     }
  113.     public function setDateCreation(\DateTimeInterface $dateCreation): self
  114.     {
  115.         $this->dateCreation $dateCreation;
  116.         return $this;
  117.     }
  118.     public function getDateModification(): ?\DateTimeInterface
  119.     {
  120.         return $this->dateModification;
  121.     }
  122.     public function setDateModification(\DateTimeInterface $dateModification): self
  123.     {
  124.         $this->dateModification $dateModification;
  125.         return $this;
  126.     }
  127.     public function getSecteur(): ?Secteur
  128.     {
  129.         return $this->secteur;
  130.     }
  131.     public function setSecteur(?Secteur $secteur): self
  132.     {
  133.         $this->secteur $secteur;
  134.         return $this;
  135.     }
  136.     public function getSecteurTexteMailType(): ?SecteurTexteMailType
  137.     {
  138.         return $this->secteurTexteMailType;
  139.     }
  140.     public function setSecteurTexteMailType(?SecteurTexteMailType $secteurTexteMailType): self
  141.     {
  142.         $this->secteurTexteMailType $secteurTexteMailType;
  143.         return $this;
  144.     }
  145.     /**
  146.      * @ORM\PrePersist
  147.      */
  148.     public function setCreatedAtValue()
  149.     {
  150.         $this->dateCreation = new \DateTimeImmutable();
  151.     }
  152.     /**
  153.      * Helpers
  154.      */
  155.     public function cleanMessage($message)
  156.     {
  157.         return trim(html_entity_decode(str_replace('&nbsp;','',strip_tags($message)),ENT_COMPAT,'UTF-8'));
  158.     }
  159. }