<?php
namespace App\Entity;
use ApiPlatform\Core\Annotation\ApiResource;
use App\Repository\OffresRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: OffresRepository::class)]
#[ApiResource]
class Offres
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $titre = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $prix = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $option1 = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $option2 = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $option3 = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $option4 = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $option5 = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $duree = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $dateexp = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $affiche = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $description = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $slug = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $imagefront = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $valeurreduction = null;
#[ORM\ManyToMany(targetEntity: Formation::class, inversedBy: 'offres')]
private Collection $formation;
#[ORM\OneToMany(mappedBy: 'offres', targetEntity: Offresinscrit::class,cascade: ['remove'])]
private Collection $inscrit;
#[ORM\OneToMany(mappedBy: 'offres', targetEntity: Voucher::class,cascade: ['remove'])]
private Collection $voucher;
public function __construct()
{
$this->formation = new ArrayCollection();
$this->inscrit = new ArrayCollection();
$this->voucher = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getTitre(): ?string
{
return $this->titre;
}
public function setTitre(?string $titre): self
{
$this->titre = $titre;
return $this;
}
public function getPrix(): ?string
{
return $this->prix;
}
public function setPrix(?string $prix): self
{
$this->prix = $prix;
return $this;
}
public function getOption1(): ?string
{
return $this->option1;
}
public function setOption1(?string $option1): self
{
$this->option1 = $option1;
return $this;
}
public function getOption2(): ?string
{
return $this->option2;
}
public function setOption2(?string $option2): self
{
$this->option2 = $option2;
return $this;
}
public function getOption3(): ?string
{
return $this->option3;
}
public function setOption3(?string $option3): self
{
$this->option3 = $option3;
return $this;
}
public function getOption4(): ?string
{
return $this->option4;
}
public function setOption4(?string $option4): self
{
$this->option4 = $option4;
return $this;
}
public function getOption5(): ?string
{
return $this->option5;
}
public function setOption5(?string $option5): self
{
$this->option5 = $option5;
return $this;
}
public function getDuree(): ?string
{
return $this->duree;
}
public function setDuree(?string $duree): self
{
$this->duree = $duree;
return $this;
}
public function getDateexp(): ?\DateTimeInterface
{
return $this->dateexp;
}
public function setDateexp(?\DateTimeInterface $dateexp): self
{
$this->dateexp = $dateexp;
return $this;
}
public function getAffiche(): ?string
{
return $this->affiche;
}
public function setAffiche(?string $affiche): self
{
$this->affiche = $affiche;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(?string $slug): self
{
$this->slug = $slug;
return $this;
}
public function getImagefront(): ?string
{
return $this->imagefront;
}
public function setImagefront(?string $imagefront): self
{
$this->imagefront = $imagefront;
return $this;
}
public function getValeurreduction(): ?string
{
return $this->valeurreduction;
}
public function setValeurreduction(?string $valeurreduction): self
{
$this->valeurreduction = $valeurreduction;
return $this;
}
/**
* @return Collection<int, Formation>
*/
public function getFormation(): Collection
{
return $this->formation;
}
public function addFormation(Formation $formation): self
{
if (!$this->formation->contains($formation)) {
$this->formation->add($formation);
}
return $this;
}
public function removeFormation(Formation $formation): self
{
$this->formation->removeElement($formation);
return $this;
}
/**
* @return Collection<int, Offresinscrit>
*/
public function getInscrit(): Collection
{
return $this->inscrit;
}
public function addInscrit(Offresinscrit $inscrit): self
{
if (!$this->inscrit->contains($inscrit)) {
$this->inscrit->add($inscrit);
$inscrit->setOffres($this);
}
return $this;
}
public function removeInscrit(Offresinscrit $inscrit): self
{
if ($this->inscrit->removeElement($inscrit)) {
// set the owning side to null (unless already changed)
if ($inscrit->getOffres() === $this) {
$inscrit->setOffres(null);
}
}
return $this;
}
/**
* @return Collection<int, Voucher>
*/
public function getVoucher(): Collection
{
return $this->voucher;
}
public function addVoucher(Voucher $voucher): self
{
if (!$this->voucher->contains($voucher)) {
$this->voucher->add($voucher);
$voucher->setOffres($this);
}
return $this;
}
public function removeVoucher(Voucher $voucher): self
{
if ($this->voucher->removeElement($voucher)) {
// set the owning side to null (unless already changed)
if ($voucher->getOffres() === $this) {
$voucher->setOffres(null);
}
}
return $this;
}
}