<?php
namespace App\Entity;
use App\Repository\TrainingRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection as A;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: TrainingRepository::class)]
class Training
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 1024, nullable: true)]
private ?string $name = null;
#[ORM\Column]
private ?bool $enabled = null;
#[ORM\Column(type: Types::SMALLINT, nullable: true)]
private ?int $month = null;
#[ORM\Column(nullable: true)]
private ?int $ypareo = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $completeName = null;
#[ORM\Column]
private ?bool $parcourssup = null;
#[ORM\OneToMany(mappedBy: 'training', targetEntity: User::class)]
private A $users;
#[ORM\ManyToMany(targetEntity: MCQType::class, mappedBy: 'trainings')]
private A $mCQTypes;
#[ORM\Column(length: 255, nullable: true)]
private ?string $level = null;
#[ORM\ManyToMany(targetEntity: Offer::class, mappedBy: 'training')]
private A $offers;
#[ORM\ManyToMany(targetEntity: Appointment::class, mappedBy: 'training')]
private A $appointments;
#[ORM\Column(length: 255, nullable: true)]
private ?string $levelName = null;
#[ORM\OneToMany(mappedBy: 'training', targetEntity: TrainingGroupAF::class)]
private A $trainingGroupAFs;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private \DateTimeInterface|null $closing_date = null;
public function __construct()
{
$this->users = new ArrayCollection();
$this->mCQTypes = new ArrayCollection();
$this->offers = new ArrayCollection();
$this->appointments = new ArrayCollection();
$this->trainingGroupAFs = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function isEnabled(): ?bool
{
return $this->enabled;
}
public function setEnabled(bool $enabled): self
{
$this->enabled = $enabled;
return $this;
}
public function getMonth(): ?int
{
return $this->month;
}
public function setMonth(int $month): self
{
$this->month = $month;
return $this;
}
public function getYpareo(): ?int
{
return $this->ypareo;
}
public function setYpareo(int $ypareo): self
{
$this->ypareo = $ypareo;
return $this;
}
public function getCompleteName(): ?string
{
return $this->completeName;
}
public function setCompleteName(?string $completeName): self
{
$this->completeName = $completeName;
return $this;
}
public function isParcourssup(): ?bool
{
return $this->parcourssup;
}
public function setParcourssup(bool $parcourssup): self
{
$this->parcourssup = $parcourssup;
return $this;
}
/**
* @return A
*/
public function getUser(): A
{
return $this->users;
}
public function addUser(User $user): self
{
if (!$this->users->contains($user)) {
$this->users->add($user);
$user->setTraining($this);
}
return $this;
}
public function removeUser(User $user): self
{
if ($this->users->removeElement($user)) {
// set the owning side to null (unless already changed)
if ($user->getTraining() === $this) {
$user->setTraining(null);
}
}
return $this;
}
/**
* @return A
*/
public function getMCQTypes(): A
{
return $this->mCQTypes;
}
public function addMCQType(MCQType $mCQType): self
{
if (!$this->mCQTypes->contains($mCQType)) {
$this->mCQTypes->add($mCQType);
$mCQType->addTraining($this);
}
return $this;
}
public function removeMCQType(MCQType $mCQType): self
{
if ($this->mCQTypes->removeElement($mCQType)) {
$mCQType->removeTraining($this);
}
return $this;
}
public function getLevel(): ?string
{
return $this->level;
}
public function setLevel(?string $level): self
{
$this->level = $level;
return $this;
}
/**
* @return A<int, Offer>
*/
public function getOffers(): A
{
return $this->offers;
}
public function addOffer(Offer $offer): self
{
if (!$this->offers->contains($offer)) {
$this->offers->add($offer);
$offer->addTraining($this);
}
return $this;
}
public function removeOffer(Offer $offer): self
{
if ($this->offers->removeElement($offer)) {
$offer->removeTraining($this);
}
return $this;
}
/**
* @return A<int, Appointment>
*/
public function getAppointments(): A
{
return $this->appointments;
}
public function addAppointment(Appointment $appointment): self
{
if (!$this->appointments->contains($appointment)) {
$this->appointments->add($appointment);
$appointment->addTraining($this);
}
return $this;
}
public function removeAppointment(Appointment $appointment): self
{
if ($this->appointments->removeElement($appointment)) {
$appointment->removeTraining($this);
}
return $this;
}
public function getLevelName(): ?string
{
return $this->levelName;
}
public function setLevelName(?string $levelName): self
{
$this->levelName = $levelName;
return $this;
}
/**
* @return A<int, TrainingGroupAF>
*/
public function getTrainingGroupAFs(): A
{
return $this->trainingGroupAFs;
}
public function addTrainingGroupAF(TrainingGroupAF $trainingGroupAF): self
{
if (!$this->trainingGroupAFs->contains($trainingGroupAF)) {
$this->trainingGroupAFs->add($trainingGroupAF);
$trainingGroupAF->setTraining($this);
}
return $this;
}
public function removeTrainingGroupAF(TrainingGroupAF $trainingGroupAF): self
{
if ($this->trainingGroupAFs->removeElement($trainingGroupAF)) {
// set the owning side to null (unless already changed)
if ($trainingGroupAF->getTraining() === $this) {
$trainingGroupAF->setTraining(null);
}
}
return $this;
}
public function getClosingDate(): \DateTimeInterface|null
{
return $this->closing_date;
}
public function setClosingDate(\DateTimeInterface|null $closing_date): self
{
$this->closing_date = $closing_date;
return $this;
}
}