<?php
namespace App\Entity;
use App\Repository\PodcastPrivateRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
use Symfony\Component\Validator\Constraints as Assert;
// Podcast private = Place à l'expert pour actualité du mois et abonnés externes
/**
* @Vich\Uploadable
*/
#[ORM\Entity(repositoryClass: PodcastPrivateRepository::class)]
class PodcastPrivate
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\ManyToOne(targetEntity: PodcastExpert::class, inversedBy: 'podcastPrivates')]
#[ORM\JoinColumn(nullable: false)]
private $podcastExpert;
#[ORM\Column(type: 'integer')]
private $number;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $title;
#[ORM\Column(type: 'text', nullable: true)]
private $main_description_txt;
#[ORM\Column(type: 'text', nullable: true)]
private $main_description_rtf;
#[ORM\Column(type: 'text', nullable: true)]
private $sub_description_txt;
#[ORM\Column(type: 'text', nullable: true)]
private $sub_description_rtf;
#[ORM\Column(type: 'text', nullable: true)]
private $notes_txt;
#[ORM\Column(type: 'text', nullable: true)]
private $notes_rtf;
#[ORM\Column(type: 'date')]
private $publishedDate;
#[ORM\Column(type: 'date', nullable: true, options: ['comment' => 'période'])]
private $dateActuv2;
// NOTE: This is not a mapped field of entity metadata, just a simple property.
/**
* @Vich\UploadableField(mapping="podcast_middle_file", fileNameProperty="podcastMiddleFilename")
* @var File|null
*/
private ?File $podcastMiddleFile = null;
#[ORM\Column(nullable: true)]
private ?string $podcastMiddleFilename = null;
#[ORM\Column(type: 'datetime_immutable')]
private $updateAt;
#[ORM\Column(type: 'boolean', nullable: true)]
private $generate;
#[ORM\OneToMany(mappedBy: 'podcastPrivate', targetEntity: PodcastPrivateAccountingFirm::class, orphanRemoval:true)]
private $podcastPrivateAccountingFirms;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $idAushaPlaylist;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $idAushaEpisodeEc;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $filenameEc;
#[ORM\ManyToMany(targetEntity: self::class, inversedBy: 'podcastPrivates')]
#[Assert\Count( max: 2, maxMessage: 'Vous ne pouvez choisir que 2 podcasts associés au maximum')]
private $podcastsAssociates;
#[ORM\ManyToMany(targetEntity: self::class, mappedBy: 'podcastsAssociates')]
private $podcastPrivates;
#[ORM\OneToMany(mappedBy: 'PodcastPrivate', targetEntity: PodcastPrivateTask::class)]
private $podcastPrivateTasks;
// NOTE: This is not a mapped field of entity metadata, just a simple property.
/**
* @Vich\UploadableField(mapping="podcast_private_image_file", fileNameProperty="imageName")
* @var File|null
*/
private ?File $imageFile = null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $imageName = null;
public function __construct()
{
$this->setUpdateAt(new \DateTimeImmutable());
$this->podcastPrivateAccountingFirms = new ArrayCollection();
$this->podcastsAssociates = new ArrayCollection();
$this->podcastPrivates = new ArrayCollection();
$this->podcastPrivateTasks = new ArrayCollection();
}
public function __toString()
{
return "#" . $this->getNumber() . " - " . $this->getTitle() ?? $this->getTitle();
}
public function getId(): ?int
{
return $this->id;
}
public function getPodcastExpert(): ?PodcastExpert
{
return $this->podcastExpert;
}
public function setPodcastExpert(?PodcastExpert $podcastExpert): self
{
$this->podcastExpert = $podcastExpert;
return $this;
}
public function getNumber(): ?int
{
return $this->number;
}
public function setNumber(int $number): self
{
$this->number = $number;
return $this;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(?string $title): self
{
$this->title = $title;
return $this;
}
public function getMainDescriptionTxt(): ?string
{
return $this->main_description_txt;
}
public function setMainDescriptionTxt(?string $main_description_txt): self
{
$this->main_description_txt = $main_description_txt;
return $this;
}
public function getMainDescriptionRtf(): ?string
{
return $this->main_description_rtf;
}
public function setMainDescriptionRtf(?string $main_description_rtf): self
{
$this->main_description_rtf = $main_description_rtf;
$descriptifTexte = str_replace(' ', ' ', $main_description_rtf);
$descriptifTexte = str_replace('<br />', ' ', $descriptifTexte);
$descriptifTexte = strip_tags($descriptifTexte);
$this->main_description_txt = $descriptifTexte;
return $this;
}
public function getSubDescriptionTxt(): ?string
{
return $this->sub_description_txt;
}
public function setSubDescriptionTxt(?string $sub_description_txt): self
{
$this->sub_description_txt = $sub_description_txt;
return $this;
}
public function getSubDescriptionRtf(): ?string
{
return $this->sub_description_rtf;
}
public function setSubDescriptionRtf(?string $sub_description_rtf): self
{
$this->sub_description_rtf = $sub_description_rtf;
$descriptifTexte = str_replace(' ', ' ', $sub_description_rtf);
$descriptifTexte = str_replace('<br />', ' ', $descriptifTexte);
$descriptifTexte = strip_tags($descriptifTexte);
$this->sub_description_txt = $descriptifTexte;
return $this;
}
public function getNotesTxt(): ?string
{
return $this->notes_txt;
}
public function setNotesTxt(?string $notes_txt): self
{
$this->notes_txt = $notes_txt;
return $this;
}
public function getNotesRtf(): ?string
{
return $this->notes_rtf;
}
public function setNotesRtf(?string $notes_rtf): self
{
$this->notes_rtf = $notes_rtf;
return $this;
}
public function getPublishedDate(): ?\DateTimeInterface
{
return $this->publishedDate;
}
public function setPublishedDate(\DateTimeInterface $publishedDate): self
{
$this->publishedDate = $publishedDate;
return $this;
}
public function getDateActuv2(): ?\DateTimeInterface
{
return $this->dateActuv2;
}
public function setDateActuv2(?\DateTimeInterface $dateActuv2): self
{
$this->dateActuv2 = $dateActuv2;
return $this;
}
/**
* If manually uploading a file (i.e. not using Symfony Form) ensure an instance
* of 'UploadedFile' is injected into this setter to trigger the update. If this
* bundle's configuration parameter 'inject_on_load' is set to 'true' this setter
* must be able to accept an instance of 'File' as the bundle will inject one here
* during Doctrine hydration.
*
* @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $imageFile
*/
public function setPodcastMiddleFile(?File $podcastMiddleFile = null): void
{
$this->podcastMiddleFile = $podcastMiddleFile;
if (null !== $podcastMiddleFile) {
// It is required that at least one field changes if you are using doctrine
// otherwise the event listeners won't be called and the file is lost
$this->updateAt = new \DateTimeImmutable();
}
}
public function getPodcastMiddleFile(): ?File
{
return $this->podcastMiddleFile;
}
public function setPodcastMiddleFileName(?string $podcastMiddleFilename): void
{
$this->podcastMiddleFilename = $podcastMiddleFilename;
}
public function getPodcastMiddleFileName(): ?string
{
return $this->podcastMiddleFilename;
}
public function getUpdateAt(): ?\DateTimeImmutable
{
return $this->updateAt;
}
public function setUpdateAt(\DateTimeImmutable $updateAt): self
{
$this->updateAt = $updateAt;
return $this;
}
public function isGenerate(): ?bool
{
return $this->generate;
}
public function setGenerate(?bool $generate): self
{
$this->generate = $generate;
return $this;
}
/**
* @return Collection<int, PodcastPrivateAccountingFirm>
*/
public function getPodcastPrivateAccountingFirms(): Collection
{
return $this->podcastPrivateAccountingFirms;
}
public function addPodcastPrivateAccountingFirm(PodcastPrivateAccountingFirm $podcastPrivateAccountingFirm): self
{
if (!$this->podcastPrivateAccountingFirms->contains($podcastPrivateAccountingFirm)) {
$this->podcastPrivateAccountingFirms[] = $podcastPrivateAccountingFirm;
$podcastPrivateAccountingFirm->setPodcastPrivate($this);
}
return $this;
}
public function removePodcastPrivateAccountingFirm(PodcastPrivateAccountingFirm $podcastPrivateAccountingFirm): self
{
if ($this->podcastPrivateAccountingFirms->removeElement($podcastPrivateAccountingFirm)) {
// set the owning side to null (unless already changed)
if ($podcastPrivateAccountingFirm->getPodcastPrivate() === $this) {
$podcastPrivateAccountingFirm->setPodcastPrivate(null);
}
}
return $this;
}
public function getIdAushaPlaylist(): ?string
{
return $this->idAushaPlaylist;
}
public function setIdAushaPlaylist(?string $idAushaPlaylist): self
{
$this->idAushaPlaylist = $idAushaPlaylist;
return $this;
}
public function getIdAushaEpisodeEc(): ?string
{
return $this->idAushaEpisodeEc;
}
public function setIdAushaEpisodeEc(?string $idAushaEpisodeEc): self
{
$this->idAushaEpisodeEc = $idAushaEpisodeEc;
return $this;
}
public function getFilenameEc(): ?string
{
return $this->filenameEc;
}
public function setFilenameEc(?string $filenameEc): self
{
$this->filenameEc = $filenameEc;
return $this;
}
/**
* @return Collection<int, self>
*/
public function getPodcastsAssociates(): Collection
{
return $this->podcastsAssociates;
}
public function addPodcastsAssociate(self $podcastsAssociate): self
{
if (!$this->podcastsAssociates->contains($podcastsAssociate)) {
$this->podcastsAssociates[] = $podcastsAssociate;
}
return $this;
}
public function removePodcastsAssociate(self $podcastsAssociate): self
{
$this->podcastsAssociates->removeElement($podcastsAssociate);
return $this;
}
/**
* @return Collection<int, self>
*/
public function getPodcastPrivates(): Collection
{
return $this->podcastPrivates;
}
public function addPodcastPrivate(self $podcastPrivate): self
{
if (!$this->podcastPrivates->contains($podcastPrivate)) {
$this->podcastPrivates[] = $podcastPrivate;
$podcastPrivate->addPodcastsAssociate($this);
}
return $this;
}
public function removePodcastPrivate(self $podcastPrivate): self
{
if ($this->podcastPrivates->removeElement($podcastPrivate)) {
$podcastPrivate->removePodcastsAssociate($this);
}
return $this;
}
/**
* @return Collection<int, PodcastPrivateTask>
*/
public function getPodcastPrivateTasks(): Collection
{
return $this->podcastPrivateTasks;
}
public function addPodcastPrivateTask(PodcastPrivateTask $podcastPrivateTask): self
{
if (!$this->podcastPrivateTasks->contains($podcastPrivateTask)) {
$this->podcastPrivateTasks[] = $podcastPrivateTask;
$podcastPrivateTask->setPodcastPrivate($this);
}
return $this;
}
public function removePodcastPrivateTask(PodcastPrivateTask $podcastPrivateTask): self
{
if ($this->podcastPrivateTasks->removeElement($podcastPrivateTask)) {
// set the owning side to null (unless already changed)
if ($podcastPrivateTask->getPodcastPrivate() === $this) {
$podcastPrivateTask->setPodcastPrivate(null);
}
}
return $this;
}
public function setImageFile(?File $imageFile = null): void
{
$this->imageFile = $imageFile;
if (null !== $imageFile) {
// It is required that at least one field changes if you are using doctrine
// otherwise the event listeners won't be called and the file is lost
$this->updateAt = new \DateTimeImmutable();
}
}
public function getImageFile(): ?File
{
return $this->imageFile;
}
public function setImageName(?string $imageName): void
{
$this->imageName = $imageName;
}
public function getImageName(): ?string
{
return $this->imageName;
}
}