src/Entity/Actualitecabinet.php line 20

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Symfony\Component\HttpFoundation\File\File;
  5. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  6. use App\Validator;
  7. use Symfony\Component\Validator\Constraints as Assert;
  8. use Gedmo\Mapping\Annotation as Gedmo;
  9. use App\Repository\ActualitecabinetRepository;
  10. /**
  11.  * Actualitecabinet
  12.  *
  13.  * @Vich\Uploadable
  14.  */
  15. #[ORM\Table(name'actualiteCabinet')]
  16. #[ORM\Entity(repositoryClassActualitecabinetRepository::class)]
  17. class Actualitecabinet
  18. {
  19.     /**
  20.      * @var int
  21.      *
  22.      */
  23.     #[ORM\Column(name'id'type'bigint'nullablefalse)]
  24.     #[ORM\Id]
  25.     #[ORM\GeneratedValue(strategy'IDENTITY')]
  26.     private $id;
  27.     /**
  28.      * @var string
  29.      *
  30.      */
  31.     #[ORM\Column(name'titre'type'string'length255nullablefalse)]
  32.     #[Assert\NotBlank]
  33.     private $titre;
  34. /**
  35.      * @Gedmo\Slug(fields={"titre"})
  36.      */
  37.     #[ORM\Column(nullabletrue)]
  38.     private $slug;
  39.     /**
  40.      * @var string
  41.      *
  42.      */
  43.     #[ORM\Column(name'descriptifTexte'type'text'nullablefalse)]
  44.     private $descriptifTexte;
  45.     /**
  46.      * @var string
  47.      *
  48.      */
  49.     #[ORM\Column(name'descriptifRTF'type'text'nullablefalse)]
  50.     #[Assert\NotBlank]
  51.     private $descriptifrtf;
  52.     /**
  53.      * @var \DateTime
  54.      *
  55.      */
  56.     #[ORM\Column(name'dateActualite'type'date'nullablefalse)]
  57.     private $dateactualite;
  58.     /**
  59.      * @var AccountingFirm
  60.      *
  61.      */
  62.     #[ORM\JoinColumn(name'FK_cabinet'referencedColumnName'id')]
  63.     #[ORM\ManyToOne(targetEntity'AccountingFirm'inversedBy'actualitecabinets')]
  64.     private $accountingFirm;
  65.     #[ORM\Column(type'string'length255nullabletrue)]
  66.     private $file null;
  67.     #[ORM\Column(type'datetime'length255nullabletrue)]
  68.     private $updatedAt null;
  69.     /**
  70.      * @Vich\UploadableField(mapping="documents", fileNameProperty="file")
  71.      * @var File|null
  72.      */
  73.     private $tmpFile null;
  74.     #[ORM\Column(type'string'length255nullabletrue)]
  75.     private $photo null;
  76.     /**
  77.      * @Vich\UploadableField(mapping="photos", fileNameProperty="photo")
  78.      * @var File|null
  79.      */
  80.     private $tmpPhoto null;
  81.     #[ORM\Column(type'string'length255nullabletrue)]
  82.     private $url;
  83.     #[ORM\Column(type'string'length255nullabletrue)]
  84.     private $urlTitle;
  85.     #[ORM\Column(type'string'length255nullabletrue)]
  86.     private $fileTitle;
  87.     #[ORM\Column(type'string'length255nullabletrue)]
  88.     private $youtube;
  89.     #[ORM\Column(type'string'length2nullabletrue)]
  90.     #[Assert\NotNull]
  91.     private $month;
  92.     #[ORM\Column(type'string'length4)]
  93.     #[Assert\NotNull]
  94.     private $year;
  95.     /**
  96.      * @return int
  97.      */
  98.     public function getId(): ?int
  99.     {
  100.         return $this->id;
  101.     }
  102.     /**
  103.      * @return string
  104.      */
  105.     public function getTitre(): ?string
  106.     {
  107.         return $this->titre;
  108.     }
  109.     /**
  110.      * @param string $titre
  111.      * @return Actualitecabinet
  112.      */
  113.     public function setTitre(string $titre): Actualitecabinet
  114.     {
  115.         $this->titre $titre;
  116.         return $this;
  117.     }
  118.     /**
  119.      * @return string
  120.      */
  121.     public function getDescriptiftexte(): string
  122.     {
  123.         return $this->descriptifTexte;
  124.     }
  125.     /**
  126.      * @param string $descriptifTexte
  127.      * @return Actualitecabinet
  128.      */
  129.     public function setDescriptiftexte(string $descriptifTexte): Actualitecabinet
  130.     {
  131.         $this->descriptifTexte $descriptifTexte;
  132.         return $this;
  133.     }
  134.     /**
  135.      * @return string
  136.      */
  137.     public function getDescriptifrtf(): string
  138.     {
  139.         return $this->descriptifrtf;
  140.     }
  141.     /**
  142.      * @param string $descriptifrtf
  143.      * @return Actualitecabinet
  144.      */
  145.     public function setDescriptifrtf(?string $descriptifrtf): Actualitecabinet
  146.     {
  147.         $this->descriptifrtf $descriptifrtf;
  148.         $this->descriptifTexte strip_tags($descriptifrtf);
  149.         return $this;
  150.     }
  151.     /**
  152.      * @return \DateTime
  153.      */
  154.     public function getDateactualite(): ?\DateTime
  155.     {
  156.         return $this->dateactualite;
  157.     }
  158.     /**
  159.      * @param \DateTime $dateactualite
  160.      * @return Actualitecabinet
  161.      */
  162.     public function setDateactualite(\DateTime $dateactualite): Actualitecabinet
  163.     {
  164.         $this->dateactualite $dateactualite;
  165.         return $this;
  166.     }
  167.     /**
  168.      * @return AccountingFirm
  169.      */
  170.     public function getAccountingFirm(): ?AccountingFirm
  171.     {
  172.         return $this->accountingFirm;
  173.     }
  174.     /**
  175.      * @param AccountingFirm $accountingFirm
  176.      * @return Actualitecabinet
  177.      */
  178.     public function setAccountingFirm(?AccountingFirm $accountingFirm): Actualitecabinet
  179.     {
  180.         $this->accountingFirm $accountingFirm;
  181.         return $this;
  182.     }
  183.     public function getFile(): ?string
  184.     {
  185.         return $this->file;
  186.     }
  187.     public function setFile(?string $file): self
  188.     {
  189.         $this->file $file;
  190.         return $this;
  191.     }
  192.     public function setTmpFile(?File $tmpFile null): void
  193.     {
  194.         $this->tmpFile $tmpFile;
  195.         $this->updatedAt = new \DateTime('now');
  196.     }
  197.     public function getTmpFile() : ?File
  198.     {
  199.         return $this->tmpFile;
  200.     }
  201.     public function setTmpPhoto(?File $tmpPhoto null): void
  202.     {
  203.         $this->tmpPhoto $tmpPhoto;
  204.         $this->updatedAt = new \DateTime('now');
  205.     }
  206.     public function getTmpPhoto() : ?File
  207.     {
  208.         return $this->tmpPhoto;
  209.     }
  210.     public function getPhoto(): ?string
  211.     {
  212.         return $this->photo;
  213.     }
  214.     public function setPhoto(?string $photo): self
  215.     {
  216.         $this->photo $photo;
  217.         return $this;
  218.     }
  219.     /**
  220.      * @return null
  221.      */
  222.     public function getUpdatedAt()
  223.     {
  224.         return $this->updatedAt;
  225.     }
  226.     /**
  227.      * @param null $updatedAt
  228.      * @return Actualitecabinet
  229.      */
  230.     public function setUpdatedAt($updatedAt)
  231.     {
  232.         $this->updatedAt $updatedAt;
  233.         return $this;
  234.     }
  235.     public function getUrl(): ?string
  236.     {
  237.         return $this->url;
  238.     }
  239.     public function setUrl(?string $url): self
  240.     {
  241.         $this->url $url;
  242.         return $this;
  243.     }
  244.     public function getUrlTitle(): ?string
  245.     {
  246.         return $this->urlTitle;
  247.     }
  248.     public function setUrlTitle(?string $urlTitle): self
  249.     {
  250.         $this->urlTitle $urlTitle;
  251.         return $this;
  252.     }
  253.     public function getFileTitle(): ?string
  254.     {
  255.         return $this->fileTitle;
  256.     }
  257.     public function setFileTitle(?string $fileTitle): self
  258.     {
  259.         $this->fileTitle $fileTitle;
  260.         return $this;
  261.     }
  262.     public function getYoutube(): ?string
  263.     {
  264.         return $this->youtube;
  265.     }
  266.     public function setYoutube(?string $youtube): self
  267.     {
  268.         $this->youtube $youtube;
  269.         return $this;
  270.     }
  271.     public function getMonth(): ?string
  272.     {
  273.         if (null === $this->month && $this->getDateactualite()) {
  274.             $this->month $this->getDateactualite()->format('m');
  275.         }
  276.         return $this->month;
  277.     }
  278.     public function setMonth(?string $month): self
  279.     {
  280.         $this->month $month;
  281.         if ($this->year && $this->month) {
  282.             $this->setDateactualite(
  283.                 new \DateTime($this->year '-' $this->month '-01 12:00:00')
  284.             );
  285.         }
  286.         return $this;
  287.     }
  288.     public function getYear(): ?string
  289.     {
  290.         if (null === $this->year && $this->getDateactualite()) {
  291.             $this->year $this->getDateactualite()->format('Y');
  292.         }
  293.         return $this->year;
  294.     }
  295.     public function setYear(string $year): self
  296.     {
  297.         $this->year $year;
  298.         if ($this->year && $this->month) {
  299.             $this->setDateactualite(
  300.                 new \DateTime($this->year '-' $this->month '-01 12:00:00')
  301.             );
  302.         }
  303.         return $this;
  304.     }
  305.     public function getSlug()
  306.     {
  307.         return $this->slug;
  308.     }
  309. }