src/Entity/PodcastPrivate.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\PodcastPrivateRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\HttpFoundation\File\File;
  8. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  9. use Symfony\Component\Validator\Constraints as Assert;
  10. // Podcast private = Place à l'expert pour actualité du mois et abonnés externes
  11. /**
  12.  * @Vich\Uploadable
  13.  */
  14. #[ORM\Entity(repositoryClassPodcastPrivateRepository::class)]
  15. class PodcastPrivate
  16. {
  17.     #[ORM\Id]
  18.     #[ORM\GeneratedValue]
  19.     #[ORM\Column(type'integer')]
  20.     private $id;
  21.     #[ORM\ManyToOne(targetEntityPodcastExpert::class, inversedBy'podcastPrivates')]
  22.     #[ORM\JoinColumn(nullablefalse)]
  23.     private $podcastExpert;
  24.     #[ORM\Column(type'integer')]
  25.     private $number;
  26.     #[ORM\Column(type'string'length255nullabletrue)]
  27.     private $title;
  28.     #[ORM\Column(type'text'nullabletrue)]
  29.     private $main_description_txt;
  30.     #[ORM\Column(type'text'nullabletrue)]
  31.     private $main_description_rtf;
  32.     #[ORM\Column(type'text'nullabletrue)]
  33.     private $sub_description_txt;
  34.     #[ORM\Column(type'text'nullabletrue)]
  35.     private $sub_description_rtf;
  36.     #[ORM\Column(type'text'nullabletrue)]
  37.     private $notes_txt;
  38.     #[ORM\Column(type'text'nullabletrue)]
  39.     private $notes_rtf;
  40.     #[ORM\Column(type'date')]
  41.     private $publishedDate;
  42.     #[ORM\Column(type'date'nullabletrueoptions: ['comment' => 'période'])]
  43.     private $dateActuv2;
  44.     // NOTE: This is not a mapped field of entity metadata, just a simple property.
  45.     /**
  46.      * @Vich\UploadableField(mapping="podcast_middle_file", fileNameProperty="podcastMiddleFilename")
  47.      * @var File|null
  48.      */
  49.     private ?File $podcastMiddleFile null;
  50.     #[ORM\Column(nullabletrue)]
  51.     private ?string $podcastMiddleFilename null;
  52.     #[ORM\Column(type'datetime_immutable')]
  53.     private $updateAt;
  54.     #[ORM\Column(type'boolean'nullabletrue)]
  55.     private $generate;
  56.     #[ORM\OneToMany(mappedBy'podcastPrivate'targetEntityPodcastPrivateAccountingFirm::class, orphanRemoval:true)]
  57.     private $podcastPrivateAccountingFirms;
  58.     #[ORM\Column(type'string'length255nullabletrue)]
  59.     private $idAushaPlaylist;
  60.     #[ORM\Column(type'string'length255nullabletrue)]
  61.     private $idAushaEpisodeEc;
  62.     #[ORM\Column(type'string'length255nullabletrue)]
  63.     private $filenameEc;
  64.     #[ORM\ManyToMany(targetEntityself::class, inversedBy'podcastPrivates')]
  65.     #[Assert\Countmax2maxMessage'Vous ne pouvez choisir que 2 podcasts associés au maximum')]
  66.     private $podcastsAssociates;
  67.     #[ORM\ManyToMany(targetEntityself::class, mappedBy'podcastsAssociates')]
  68.     private $podcastPrivates;
  69.     #[ORM\OneToMany(mappedBy'PodcastPrivate'targetEntityPodcastPrivateTask::class)]
  70.     private $podcastPrivateTasks;
  71.     // NOTE: This is not a mapped field of entity metadata, just a simple property.
  72.     /**
  73.      * @Vich\UploadableField(mapping="podcast_private_image_file", fileNameProperty="imageName")
  74.      * @var File|null
  75.      */
  76.     private ?File $imageFile null;
  77.     #[ORM\Column(type'string'length255nullabletrue)]
  78.     private ?string $imageName null;
  79.     public function __construct()
  80.     {
  81.         $this->setUpdateAt(new \DateTimeImmutable());
  82.         $this->podcastPrivateAccountingFirms = new ArrayCollection();
  83.         $this->podcastsAssociates = new ArrayCollection();
  84.         $this->podcastPrivates = new ArrayCollection();
  85.         $this->podcastPrivateTasks = new ArrayCollection();
  86.     }
  87.     public function __toString()
  88.     {
  89.         return "#" $this->getNumber() . " - " $this->getTitle() ?? $this->getTitle();
  90.     }
  91.     public function getId(): ?int
  92.     {
  93.         return $this->id;
  94.     }
  95.     public function getPodcastExpert(): ?PodcastExpert
  96.     {
  97.         return $this->podcastExpert;
  98.     }
  99.     public function setPodcastExpert(?PodcastExpert $podcastExpert): self
  100.     {
  101.         $this->podcastExpert $podcastExpert;
  102.         return $this;
  103.     }
  104.     public function getNumber(): ?int
  105.     {
  106.         return $this->number;
  107.     }
  108.     public function setNumber(int $number): self
  109.     {
  110.         $this->number $number;
  111.         return $this;
  112.     }
  113.     public function getTitle(): ?string
  114.     {
  115.         return $this->title;
  116.     }
  117.     public function setTitle(?string $title): self
  118.     {
  119.         $this->title $title;
  120.         return $this;
  121.     }
  122.     public function getMainDescriptionTxt(): ?string
  123.     {
  124.         return $this->main_description_txt;
  125.     }
  126.     public function setMainDescriptionTxt(?string $main_description_txt): self
  127.     {
  128.         $this->main_description_txt $main_description_txt;
  129.         return $this;
  130.     }
  131.     public function getMainDescriptionRtf(): ?string
  132.     {
  133.         return $this->main_description_rtf;
  134.     }
  135.     public function setMainDescriptionRtf(?string $main_description_rtf): self
  136.     {
  137.         $this->main_description_rtf $main_description_rtf;
  138.         $descriptifTexte str_replace('&nbsp;'' '$main_description_rtf);
  139.         $descriptifTexte str_replace('<br />'' '$descriptifTexte);
  140.         $descriptifTexte strip_tags($descriptifTexte);
  141.         $this->main_description_txt $descriptifTexte;
  142.         return $this;
  143.     }
  144.     public function getSubDescriptionTxt(): ?string
  145.     {
  146.         return $this->sub_description_txt;
  147.     }
  148.     public function setSubDescriptionTxt(?string $sub_description_txt): self
  149.     {
  150.         $this->sub_description_txt $sub_description_txt;
  151.         return $this;
  152.     }
  153.     public function getSubDescriptionRtf(): ?string
  154.     {
  155.         return $this->sub_description_rtf;
  156.     }
  157.     public function setSubDescriptionRtf(?string $sub_description_rtf): self
  158.     {
  159.         $this->sub_description_rtf $sub_description_rtf;
  160.         $descriptifTexte str_replace('&nbsp;'' '$sub_description_rtf);
  161.         $descriptifTexte str_replace('<br />'' '$descriptifTexte);
  162.         $descriptifTexte strip_tags($descriptifTexte);
  163.         $this->sub_description_txt $descriptifTexte;
  164.         return $this;
  165.     }
  166.     public function getNotesTxt(): ?string
  167.     {
  168.         return $this->notes_txt;
  169.     }
  170.     public function setNotesTxt(?string $notes_txt): self
  171.     {
  172.         $this->notes_txt $notes_txt;
  173.         return $this;
  174.     }
  175.     public function getNotesRtf(): ?string
  176.     {
  177.         return $this->notes_rtf;
  178.     }
  179.     public function setNotesRtf(?string $notes_rtf): self
  180.     {
  181.         $this->notes_rtf $notes_rtf;
  182.         return $this;
  183.     }
  184.     public function getPublishedDate(): ?\DateTimeInterface
  185.     {
  186.         return $this->publishedDate;
  187.     }
  188.     public function setPublishedDate(\DateTimeInterface $publishedDate): self
  189.     {
  190.         $this->publishedDate $publishedDate;
  191.         return $this;
  192.     }
  193.   public function getDateActuv2(): ?\DateTimeInterface
  194.   {
  195.     return $this->dateActuv2;
  196.   }
  197.   public function setDateActuv2(?\DateTimeInterface $dateActuv2): self
  198.   {
  199.     $this->dateActuv2 $dateActuv2;
  200.     return $this;
  201.   }
  202.     /**
  203.      * If manually uploading a file (i.e. not using Symfony Form) ensure an instance
  204.      * of 'UploadedFile' is injected into this setter to trigger the update. If this
  205.      * bundle's configuration parameter 'inject_on_load' is set to 'true' this setter
  206.      * must be able to accept an instance of 'File' as the bundle will inject one here
  207.      * during Doctrine hydration.
  208.      *
  209.      * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $imageFile
  210.      */
  211.     public function setPodcastMiddleFile(?File $podcastMiddleFile null): void
  212.     {
  213.         $this->podcastMiddleFile $podcastMiddleFile;
  214.         if (null !== $podcastMiddleFile) {
  215.             // It is required that at least one field changes if you are using doctrine
  216.             // otherwise the event listeners won't be called and the file is lost
  217.             $this->updateAt = new \DateTimeImmutable();
  218.         }
  219.     }
  220.     public function getPodcastMiddleFile(): ?File
  221.     {
  222.         return $this->podcastMiddleFile;
  223.     }
  224.     public function setPodcastMiddleFileName(?string $podcastMiddleFilename): void
  225.     {
  226.         $this->podcastMiddleFilename $podcastMiddleFilename;
  227.     }
  228.     public function getPodcastMiddleFileName(): ?string
  229.     {
  230.         return $this->podcastMiddleFilename;
  231.     }
  232.     public function getUpdateAt(): ?\DateTimeImmutable
  233.     {
  234.         return $this->updateAt;
  235.     }
  236.     public function setUpdateAt(\DateTimeImmutable $updateAt): self
  237.     {
  238.         $this->updateAt $updateAt;
  239.         return $this;
  240.     }
  241.     public function isGenerate(): ?bool
  242.     {
  243.         return $this->generate;
  244.     }
  245.     public function setGenerate(?bool $generate): self
  246.     {
  247.         $this->generate $generate;
  248.         return $this;
  249.     }
  250.     /**
  251.      * @return Collection<int, PodcastPrivateAccountingFirm>
  252.      */
  253.     public function getPodcastPrivateAccountingFirms(): Collection
  254.     {
  255.         return $this->podcastPrivateAccountingFirms;
  256.     }
  257.     public function addPodcastPrivateAccountingFirm(PodcastPrivateAccountingFirm $podcastPrivateAccountingFirm): self
  258.     {
  259.         if (!$this->podcastPrivateAccountingFirms->contains($podcastPrivateAccountingFirm)) {
  260.             $this->podcastPrivateAccountingFirms[] = $podcastPrivateAccountingFirm;
  261.             $podcastPrivateAccountingFirm->setPodcastPrivate($this);
  262.         }
  263.         return $this;
  264.     }
  265.     public function removePodcastPrivateAccountingFirm(PodcastPrivateAccountingFirm $podcastPrivateAccountingFirm): self
  266.     {
  267.         if ($this->podcastPrivateAccountingFirms->removeElement($podcastPrivateAccountingFirm)) {
  268.             // set the owning side to null (unless already changed)
  269.             if ($podcastPrivateAccountingFirm->getPodcastPrivate() === $this) {
  270.                 $podcastPrivateAccountingFirm->setPodcastPrivate(null);
  271.             }
  272.         }
  273.         return $this;
  274.     }
  275.     public function getIdAushaPlaylist(): ?string
  276.     {
  277.         return $this->idAushaPlaylist;
  278.     }
  279.     public function setIdAushaPlaylist(?string $idAushaPlaylist): self
  280.     {
  281.         $this->idAushaPlaylist $idAushaPlaylist;
  282.         return $this;
  283.     }
  284.     public function getIdAushaEpisodeEc(): ?string
  285.     {
  286.       return $this->idAushaEpisodeEc;
  287.     }
  288.     public function setIdAushaEpisodeEc(?string $idAushaEpisodeEc): self
  289.     {
  290.       $this->idAushaEpisodeEc $idAushaEpisodeEc;
  291.       return $this;
  292.     }
  293.     public function getFilenameEc(): ?string
  294.     {
  295.       return $this->filenameEc;
  296.     }
  297.     public function setFilenameEc(?string $filenameEc): self
  298.     {
  299.       $this->filenameEc $filenameEc;
  300.       return $this;
  301.     }
  302.     /**
  303.      * @return Collection<int, self>
  304.      */
  305.     public function getPodcastsAssociates(): Collection
  306.     {
  307.         return $this->podcastsAssociates;
  308.     }
  309.     public function addPodcastsAssociate(self $podcastsAssociate): self
  310.     {
  311.         if (!$this->podcastsAssociates->contains($podcastsAssociate)) {
  312.             $this->podcastsAssociates[] = $podcastsAssociate;
  313.         }
  314.         return $this;
  315.     }
  316.     public function removePodcastsAssociate(self $podcastsAssociate): self
  317.     {
  318.         $this->podcastsAssociates->removeElement($podcastsAssociate);
  319.         return $this;
  320.     }
  321.     /**
  322.      * @return Collection<int, self>
  323.      */
  324.     public function getPodcastPrivates(): Collection
  325.     {
  326.         return $this->podcastPrivates;
  327.     }
  328.     public function addPodcastPrivate(self $podcastPrivate): self
  329.     {
  330.         if (!$this->podcastPrivates->contains($podcastPrivate)) {
  331.             $this->podcastPrivates[] = $podcastPrivate;
  332.             $podcastPrivate->addPodcastsAssociate($this);
  333.         }
  334.         return $this;
  335.     }
  336.     public function removePodcastPrivate(self $podcastPrivate): self
  337.     {
  338.         if ($this->podcastPrivates->removeElement($podcastPrivate)) {
  339.             $podcastPrivate->removePodcastsAssociate($this);
  340.         }
  341.         return $this;
  342.     }
  343.     /**
  344.      * @return Collection<int, PodcastPrivateTask>
  345.      */
  346.     public function getPodcastPrivateTasks(): Collection
  347.     {
  348.         return $this->podcastPrivateTasks;
  349.     }
  350.     public function addPodcastPrivateTask(PodcastPrivateTask $podcastPrivateTask): self
  351.     {
  352.         if (!$this->podcastPrivateTasks->contains($podcastPrivateTask)) {
  353.             $this->podcastPrivateTasks[] = $podcastPrivateTask;
  354.             $podcastPrivateTask->setPodcastPrivate($this);
  355.         }
  356.         return $this;
  357.     }
  358.     public function removePodcastPrivateTask(PodcastPrivateTask $podcastPrivateTask): self
  359.     {
  360.         if ($this->podcastPrivateTasks->removeElement($podcastPrivateTask)) {
  361.             // set the owning side to null (unless already changed)
  362.             if ($podcastPrivateTask->getPodcastPrivate() === $this) {
  363.                 $podcastPrivateTask->setPodcastPrivate(null);
  364.             }
  365.         }
  366.         return $this;
  367.     }
  368.     public function setImageFile(?File $imageFile null): void
  369.     {
  370.         $this->imageFile $imageFile;
  371.         if (null !== $imageFile) {
  372.             // It is required that at least one field changes if you are using doctrine
  373.             // otherwise the event listeners won't be called and the file is lost
  374.             $this->updateAt = new \DateTimeImmutable();
  375.         }
  376.     }
  377.     public function getImageFile(): ?File
  378.     {
  379.         return $this->imageFile;
  380.     }
  381.     public function setImageName(?string $imageName): void
  382.     {
  383.         $this->imageName $imageName;
  384.     }
  385.     public function getImageName(): ?string
  386.     {
  387.         return $this->imageName;
  388.     }
  389. }