<?php
namespace App\Entity;
use App\Repository\AppointmentRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: AppointmentRepository::class)]
class Appointment
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\ManyToOne(inversedBy: 'appointments')]
private ?AppointmentType $appointmentType = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
private ?\DateTimeInterface $date = null;
#[ORM\Column]
private ?int $places = null;
#[ORM\ManyToMany(targetEntity: User::class, inversedBy: 'appointments')]
private Collection $user;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $description = null;
#[ORM\Column(nullable: true)]
private ?int $registrants = null;
#[ORM\Column(length: 510, nullable: true)]
private ?string $link = null;
#[ORM\ManyToMany(targetEntity: Training::class, inversedBy: 'appointments')]
private Collection $training;
#[ORM\Column(length: 510, nullable: true)]
private ?string $address = null;
#[ORM\ManyToOne(inversedBy: 'appointments')]
private ?Member $member = null;
#[ORM\OneToMany(mappedBy: 'appointment', targetEntity: AppointmentsCheck::class)]
private Collection $appointmentsChecks;
#[ORM\Column(nullable: true)]
private ?bool $enabled = null;
#[ORM\Column(nullable: true)]
private ?bool $poursuite = null;
public function __construct()
{
$this->user = new ArrayCollection();
$this->training = new ArrayCollection();
$this->appointmentsChecks = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getAppointmentType(): ?AppointmentType
{
return $this->appointmentType;
}
public function setAppointmentType(?AppointmentType $appointmentType): self
{
$this->appointmentType = $appointmentType;
return $this;
}
public function getDate(): ?\DateTimeInterface
{
return $this->date;
}
public function setDate(\DateTimeInterface $date): self
{
$this->date = $date;
return $this;
}
public function getPlaces(): ?int
{
return $this->places;
}
public function setPlaces(int $places): self
{
$this->places = $places;
return $this;
}
/**
* @return Collection<int, User>
*/
public function getUser(): Collection
{
return $this->user;
}
public function addUser(User $user): self
{
if (!$this->user->contains($user)) {
$this->user->add($user);
}
return $this;
}
public function removeUser(User $user): self
{
$this->user->removeElement($user);
return $this;
}
/**
* @return Collection<int, AppointmentsCheck>
*/
public function getAppointmentChecks(): Collection
{
return $this->appointmentsChecks;
}
// public function addAppointmentsChecks(AppointmentsCheck $appointmentsCheck): self
// {
// if (!$this->appointmentsChecks->contains($appointmentsCheck)) {
// $this->appointmentsChecks->add($appointmentsCheck);
// }
//
// return $this;
// }
//
// public function removeAppointmentsChecks(AppointmentCheck $appointmentsChecks): self
// {
// $this->appointmentsChecks->removeElement($appointmentsChecks);
//
// return $this;
// }
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getRegistrants(): ?int
{
return $this->registrants;
}
public function setRegistrants(int $registrants): self
{
$this->registrants = $registrants;
return $this;
}
public function getLink(): ?string
{
return $this->link;
}
public function setLink(?string $link): self
{
$this->link = $link;
return $this;
}
/**
* @return Collection<int, Training>
*/
public function getTraining(): Collection
{
return $this->training;
}
public function addTraining(Training $training): self
{
if (!$this->training->contains($training)) {
$this->training->add($training);
}
return $this;
}
public function removeTraining(Training $training): self
{
$this->training->removeElement($training);
return $this;
}
public function getAddress(): ?string
{
return $this->address;
}
public function setAddress(?string $address): self
{
$this->address = $address;
return $this;
}
public function getMember(): ?Member
{
return $this->member;
}
public function setMember(?Member $member): self
{
$this->member = $member;
return $this;
}
/**
* @return Collection<int, AppointmentsCheck>
*/
public function getAppointmentsChecks(): Collection
{
return $this->appointmentsChecks;
}
public function addAppointmentsCheck(AppointmentsCheck $appointmentsCheck): self
{
if (!$this->appointmentsChecks->contains($appointmentsCheck)) {
$this->appointmentsChecks->add($appointmentsCheck);
$appointmentsCheck->setAppointment($this);
}
return $this;
}
public function removeAppointmentsCheck(AppointmentsCheck $appointmentsCheck): self
{
if ($this->appointmentsChecks->removeElement($appointmentsCheck)) {
// set the owning side to null (unless already changed)
if ($appointmentsCheck->getAppointment() === $this) {
$appointmentsCheck->setAppointment(null);
}
}
return $this;
}
public function isEnabled(): ?bool
{
return $this->enabled;
}
public function setEnabled(?bool $enabled): self
{
$this->enabled = $enabled;
return $this;
}
public function isPoursuite(): ?bool
{
return $this->poursuite;
}
public function setPoursuite(?bool $poursuite): self
{
$this->poursuite = $poursuite;
return $this;
}
}