<?php
namespace App\Entity;
use App\Repository\SessionRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: SessionRepository::class)]
class Session
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $nom = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $description = null;
#[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)]
private ?\DateTimeInterface $datedebut = null;
#[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)]
private ?\DateTimeInterface $datefin = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $nbrmaxparticipants = null;
#[ORM\ManyToOne(inversedBy: 'sessions', cascade:["persist"])]
private ?Programme $programme = null;
#[ORM\OneToMany(mappedBy: 'sessions', targetEntity: Seance::class)]
private Collection $seances;
public function __construct()
{
$this->seances = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getNom(): ?string
{
return $this->nom;
}
public function setNom(string $nom): self
{
$this->nom = $nom;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getDatedebut(): ?\DateTimeInterface
{
return $this->datedebut;
}
public function setDatedebut(?\DateTimeInterface $datedebut): self
{
$this->datedebut = $datedebut;
return $this;
}
public function getDatefin(): ?\DateTimeInterface
{
return $this->datefin;
}
public function setDatefin(?\DateTimeInterface $datefin): self
{
$this->datefin = $datefin;
return $this;
}
public function getNbrmaxparticipants(): ?string
{
return $this->nbrmaxparticipants;
}
public function setNbrmaxparticipants(?string $nbrmaxparticipants): self
{
$this->nbrmaxparticipants = $nbrmaxparticipants;
return $this;
}
public function getProgramme(): ?Programme
{
return $this->programme;
}
public function setProgramme(?Programme $programme): self
{
$this->programme = $programme;
return $this;
}
/**
* @return Collection<int, Seance>
*/
public function getSeances(): Collection
{
return $this->seances;
}
public function addSeance(Seance $seance): self
{
if (!$this->seances->contains($seance)) {
$this->seances->add($seance);
$seance->setSessions($this);
}
return $this;
}
public function removeSeance(Seance $seance): self
{
if ($this->seances->removeElement($seance)) {
// set the owning side to null (unless already changed)
if ($seance->getSessions() === $this) {
$seance->setSessions(null);
}
}
return $this;
}
/**
* Returns the number of seances linked to this session.
*
* @return int
*/
public function getSeancesCount(): int
{
return $this->seances->count();
}
}