src/Entity/Gestiform/Formations/Catalogue/Theme/Theme.php line 20
<?phpnamespace App\Entity\Gestiform\Formations\Catalogue\Theme;use DateTime;use App\Entity\AbstractEntity;use App\Entity\Common\Upload;use App\Entity\Gestiform\Admin\Tarifs\TarifVenteTheme;use App\Entity\Gestiform\Admin\Tarifs\TarifVenteThemeIntra;use App\Entity\Gestiform\Formations\Catalogue\Certification;use App\Entity\Gestiform\Formations\Catalogue\Parcours\Parcours;use App\Repository\Gestiform\Formations\Catalogue\Theme\ThemeRepository;use App\Entity\Trait\SortableEntity;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: ThemeRepository::class)]class Theme extends AbstractEntity{use SortableEntity;#[ORM\Column(type: 'string', length: 255, nullable: false)]private string $intitule;#[ORM\Column(type: 'string', length: 255, nullable: true)]private ?string $code = null;#[ORM\Column(type: 'string', length: 255, nullable: true)]private ?string $altBanniere = null;#[ORM\Column(type: 'string', length: 255, nullable: true)]private ?string $altVignette = null;#[ORM\Column(type: 'string', length: 255, nullable: true)]private ?string $couleur = null;#[ORM\Column(type: 'text', nullable: true)]private ?string $commentaire = null;#[ORM\Column(type: 'string', length: 255, nullable: true)]private ?string $seotitre = null;#[ORM\Column(type: 'string', length: 255, nullable: true)]private ?string $seodescription = null;#[ORM\Column(type: 'string', length: 255, nullable: true)]private ?string $path = null;#[ORM\Column(type: 'boolean')]private ?bool $publication = true;#[ORM\JoinColumn(nullable: true)]#[ORM\OneToOne(targetEntity: Upload::class, cascade: ['persist', 'remove'])]private ?Upload $vignette = null;#[ORM\JoinColumn(nullable: true)]#[ORM\OneToOne(targetEntity: Upload::class, cascade: ['persist', 'remove'])]private ?Upload $banniere = null;#[ORM\OneToMany(mappedBy: 'theme', targetEntity: SousThemeTheme::class)]private Collection $sousThemeThemes;#[ORM\OneToMany(mappedBy: 'theme', targetEntity: Certification::class)]private Collection $certifications;#[ORM\ManyToMany(targetEntity: Parcours::class, mappedBy: 'themes')]private Collection $parcours;#[ORM\OneToMany(mappedBy: 'theme', targetEntity: TarifVenteTheme::class, cascade: ['persist', 'remove'])]private Collection $tarifsVentes;#[ORM\OneToMany(mappedBy: 'theme', targetEntity: TarifVenteThemeIntra::class, cascade: ['persist', 'remove'])]private Collection $tarifsVenteIntras;#[ORM\ManyToOne(targetEntity: TarifVenteTheme::class)]private ?TarifVenteTheme $tarifVenteDefaut = null;#[ORM\ManyToOne(targetEntity: TarifVenteThemeIntra::class)]private ?TarifVenteThemeIntra $tarifventeintradefaut = null;#[ORM\OneToMany(mappedBy: 'theme', targetEntity: Parcours::class)]private Collection $defaultParcours;public function __construct(){$this->sousThemeThemes = new ArrayCollection();$this->certifications = new ArrayCollection();$this->parcours = new ArrayCollection();$this->tarifsVentes = new ArrayCollection();$this->tarifsVenteIntras = new ArrayCollection();$this->defaultParcours = new ArrayCollection();}public function getIntitule(): ?string{return $this->intitule;}public function getTarifVenteActuel(){if (count($this->getTarifsVentes()) === 0) {return $this->getTarifVenteDefaut();}$datedujour = new DateTime();$datedujour->setTime(0, 0);// retourne le tarif dans les dates actuellesforeach ($this->getTarifsVentes() as $tarif) {if ($tarif->getStart() <= $datedujour &&($tarif->getEnd() >= $datedujour || is_null($tarif->getEnd()))) {return $tarif;}}return $this->getTarifVenteDefaut();}public function getTarifVenteIntraActuel(){$datedujour = new DateTime();$datedujour->setTime(0, 0);// retourne le tarif dans les dates actuellesforeach ($this->getTarifsVenteIntras() as $tarif) {if ($tarif->getStart() <= $datedujour && ($tarif->getEnd() >= $datedujour || is_null($tarif->getEnd()))) {return $tarif;}}return $this->getTarifVenteDefaut();}public function setIntitule(string $intitule): self{$this->intitule = $intitule;return $this;}public function getCode(): ?string{return $this->code;}public function setCode(?string $code): self{$this->code = $code;return $this;}public function getAltBanniere(): ?string{return $this->altBanniere;}public function setAltBanniere(?string $altBanniere): self{$this->altBanniere = $altBanniere;return $this;}public function getAltVignette(): ?string{return $this->altVignette;}public function setAltVignette(?string $altVignette): self{$this->altVignette = $altVignette;return $this;}public function getCouleur(): ?string{return $this->couleur;}public function setCouleur(?string $couleur): self{$this->couleur = $couleur;return $this;}public function getCommentaire(): ?string{return $this->commentaire;}public function setCommentaire(?string $commentaire): self{$this->commentaire = $commentaire;return $this;}public function getSeotitre(): ?string{return $this->seotitre;}public function setSeotitre(?string $seotitre): self{$this->seotitre = $seotitre;return $this;}public function getSeodescription(): ?string{return $this->seodescription;}public function setSeodescription(?string $seodescription): self{$this->seodescription = $seodescription;return $this;}public function getPublication(): ?bool{return $this->publication;}public function setPublication(?bool $publication): self{$this->publication = $publication;return $this;}public function getVignette(): ?Upload{return $this->vignette;}public function setVignette(?Upload $vignette): self{$this->vignette = $vignette;return $this;}public function getBanniere(): ?Upload{return $this->banniere;}public function setBanniere(?Upload $banniere): self{$this->banniere = $banniere;return $this;}public function getPath(): ?string{return $this->path;}public function setPath(?string $path): self{$this->path = $path;return $this;}/*** @return Collection<int, SousThemeTheme>*/public function getSousThemeThemes(): Collection{return $this->sousThemeThemes;}public function addSousThemeTheme(SousThemeTheme $sousThemeTheme): self{if (!$this->sousThemeThemes->contains($sousThemeTheme)) {$this->sousThemeThemes->add($sousThemeTheme);$sousThemeTheme->setTheme($this);}return $this;}public function removeSousThemeTheme(SousThemeTheme $sousThemeTheme): self{// set the owning side to null (unless already changed)if ($this->sousThemeThemes->removeElement($sousThemeTheme) && $sousThemeTheme->getTheme() === $this) {$sousThemeTheme->setTheme(null);}return $this;}/*** @return Collection<int, Parcours>*/public function getParcours(): Collection{return $this->parcours;}public function addParcour(Parcours $parcours): self{if (!$this->parcours->contains($parcours)) {$this->parcours->add($parcours);}return $this;}public function removeParcour(Parcours $parcours): self{$this->parcours->removeElement($parcours);return $this;}/*** @return Collection<int, Certification>*/public function getCertifications(): Collection{return $this->certifications;}public function addCertification(Certification $certification): self{if (!$this->certifications->contains($certification)) {$this->certifications->add($certification);$certification->setTheme($this);}return $this;}public function removeCertification(Certification $certification): self{// set the owning side to null (unless already changed)if ($this->certifications->removeElement($certification) && $certification->getTheme() === $this) {$certification->setTheme(null);}return $this;}public function isPublication(): ?bool{return $this->publication;}/*** @return Collection<int, TarifVenteTheme>*/public function getTarifsVentes(): Collection{return $this->tarifsVentes;}public function addTarifsVente(TarifVenteTheme $tarifsVente): self{if (!$this->tarifsVentes->contains($tarifsVente)) {$this->tarifsVentes->add($tarifsVente);$tarifsVente->setTheme($this);}return $this;}public function removeTarifsVente(TarifVenteTheme $tarifsVente): self{// set the owning side to null (unless already changed)if ($this->tarifsVentes->removeElement($tarifsVente) && $tarifsVente->getTheme() === $this) {$tarifsVente->setTheme(null);}return $this;}/*** @return Collection<int, TarifVenteThemeIntra>*/public function getTarifsVenteIntras(): Collection{return $this->tarifsVenteIntras;}public function addTarifsVenteIntra(TarifVenteThemeIntra $tarifsVenteIntra): self{if (!$this->tarifsVenteIntras->contains($tarifsVenteIntra)) {$this->tarifsVenteIntras->add($tarifsVenteIntra);$tarifsVenteIntra->setTheme($this);}return $this;}public function removeTarifsVenteIntra(TarifVenteThemeIntra $tarifsVenteIntra): self{// set the owning side to null (unless already changed)if ($this->tarifsVenteIntras->removeElement($tarifsVenteIntra) && $tarifsVenteIntra->getTheme() === $this) {$tarifsVenteIntra->setTheme(null);}return $this;}public function getTarifVenteDefaut(): ?TarifVenteTheme{return $this->tarifVenteDefaut;}public function setTarifVenteDefaut(?TarifVenteTheme $tarifVenteDefaut): self{$this->tarifVenteDefaut = $tarifVenteDefaut;return $this;}public function getTarifventeintradefaut(): ?TarifVenteThemeIntra{return $this->tarifventeintradefaut;}public function setTarifventeintradefaut(?TarifVenteThemeIntra $tarifventeintradefaut): self{$this->tarifventeintradefaut = $tarifventeintradefaut;return $this;}/*** @return Collection<int, Parcours>*/public function getDefaultParcours(): Collection{return $this->defaultParcours;}public function addDefaultParcour(Parcours $defaultParcour): self{if (!$this->defaultParcours->contains($defaultParcour)) {$this->defaultParcours->add($defaultParcour);$defaultParcour->setTheme($this);}return $this;}public function removeDefaultParcour(Parcours $defaultParcour): self{// set the owning side to null (unless already changed)if ($this->defaultParcours->removeElement($defaultParcour) && $defaultParcour->getTheme() === $this) {$defaultParcour->setTheme(null);}return $this;}}