219 lines
5.2 KiB
PHP
219 lines
5.2 KiB
PHP
<?php
|
|
|
|
namespace App\Entity;
|
|
|
|
use App\Repository\SortieRepository;
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
use Doctrine\Common\Collections\Collection;
|
|
use Doctrine\DBAL\Types\Types;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
use Symfony\Component\Validator\Constraints as Assert;
|
|
|
|
#[ORM\Entity(repositoryClass: SortieRepository::class)]
|
|
class Sortie
|
|
{
|
|
#[ORM\Id]
|
|
#[ORM\Column(type: 'guid', unique: true)]
|
|
#[ORM\GeneratedValue(strategy: 'CUSTOM')]
|
|
#[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')]
|
|
private ?string $idSortie = null;
|
|
|
|
#[ORM\Column(length: 255)]
|
|
private ?string $nom = null;
|
|
|
|
#[ORM\Column(type: Types::DATETIME_IMMUTABLE, nullable: true)]
|
|
#[Assert\GreaterThan(propertyPath: 'dateLimiteInscription')]
|
|
private ?\DateTimeInterface $dateHeureDebut = null;
|
|
|
|
#[ORM\Column(nullable: true)]
|
|
private ?int $duree = null;
|
|
|
|
#[ORM\Column(type: Types::DATETIME_IMMUTABLE, nullable: true)]
|
|
#[Assert\GreaterThan("today")]
|
|
private ?\DateTimeInterface $dateLimiteInscription = null;
|
|
|
|
#[ORM\Column(nullable: true)]
|
|
private ?int $nbInscriptionsMax = null;
|
|
|
|
#[ORM\Column(length: 255, nullable: true)]
|
|
private ?string $infosSortie = null;
|
|
|
|
#[ORM\ManyToOne(targetEntity: Site::class, inversedBy: 'sorties')]
|
|
#[ORM\JoinColumn(name: 'site_id', referencedColumnName: 'id_site', nullable: false)]
|
|
private ?Site $site = null;
|
|
|
|
#[ORM\ManyToOne(targetEntity: Participant::class, inversedBy: 'sortiesOrganisateur')]
|
|
#[ORM\JoinColumn(name: 'organisateur_id', referencedColumnName: 'id_participant', nullable: false)]
|
|
private ?Participant $organisateur = null;
|
|
|
|
#[ORM\ManyToOne(targetEntity: Lieu::class, inversedBy: 'sorties')]
|
|
#[ORM\JoinColumn(name: 'lieu_id', referencedColumnName: 'id_lieu', nullable: false)]
|
|
private ?Lieu $lieu = null;
|
|
|
|
#[ORM\ManyToOne(targetEntity: Etat::class, inversedBy: 'sorties')]
|
|
#[ORM\JoinColumn(name: 'etat_id', referencedColumnName: 'id_etat', nullable: false)]
|
|
private ?Etat $etat = null;
|
|
|
|
/**
|
|
* @var Collection<int, Participant>
|
|
*/
|
|
#[ORM\ManyToMany(targetEntity: Participant::class, mappedBy: 'sortiesParticipants')]
|
|
private Collection $participants;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->participants = new ArrayCollection();
|
|
}
|
|
|
|
public function getIdSortie(): ?string
|
|
{
|
|
return $this->idSortie;
|
|
}
|
|
|
|
public function getNom(): ?string
|
|
{
|
|
return $this->nom;
|
|
}
|
|
|
|
public function setNom(string $nom): self
|
|
{
|
|
$this->nom = $nom;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getDateHeureDebut(): ?\DateTimeInterface
|
|
{
|
|
return $this->dateHeureDebut;
|
|
}
|
|
|
|
public function setDateHeureDebut(?\DateTimeInterface $dateHeureDebut): self
|
|
{
|
|
$this->dateHeureDebut = $dateHeureDebut;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getDuree(): ?int
|
|
{
|
|
return $this->duree;
|
|
}
|
|
|
|
public function setDuree(?int $duree): self
|
|
{
|
|
$this->duree = $duree;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getDateLimiteInscription(): ?\DateTimeInterface
|
|
{
|
|
return $this->dateLimiteInscription;
|
|
}
|
|
|
|
public function setDateLimiteInscription(?\DateTimeInterface $dateLimiteInscription): self
|
|
{
|
|
$this->dateLimiteInscription = $dateLimiteInscription;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getNbInscriptionsMax(): ?int
|
|
{
|
|
return $this->nbInscriptionsMax;
|
|
}
|
|
|
|
public function setNbInscriptionsMax(?int $nbInscriptionsMax): self
|
|
{
|
|
$this->nbInscriptionsMax = $nbInscriptionsMax;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getInfosSortie(): ?string
|
|
{
|
|
return $this->infosSortie;
|
|
}
|
|
|
|
public function setInfosSortie(?string $infosSortie): self
|
|
{
|
|
$this->infosSortie = $infosSortie;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getSite(): ?Site
|
|
{
|
|
return $this->site;
|
|
}
|
|
|
|
public function setSite(?Site $site): self
|
|
{
|
|
$this->site = $site;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getOrganisateur(): ?Participant
|
|
{
|
|
return $this->organisateur;
|
|
}
|
|
|
|
public function setOrganisateur(?Participant $organisateur): self
|
|
{
|
|
$this->organisateur = $organisateur;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getLieu(): ?Lieu
|
|
{
|
|
return $this->lieu;
|
|
}
|
|
|
|
public function setLieu(?Lieu $lieu): self
|
|
{
|
|
$this->lieu = $lieu;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getEtat(): ?Etat
|
|
{
|
|
return $this->etat;
|
|
}
|
|
|
|
public function setEtat(?Etat $etat): self
|
|
{
|
|
$this->etat = $etat;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return Collection<int, Participant>
|
|
*/
|
|
public function getParticipants(): Collection
|
|
{
|
|
return $this->participants;
|
|
}
|
|
|
|
public function addParticipant(Participant $participant): static
|
|
{
|
|
if (!$this->participants->contains($participant)) {
|
|
$this->participants->add($participant);
|
|
$participant->addSortiesParticipant($this);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function removeParticipant(Participant $participant): static
|
|
{
|
|
$this->participants->removeElement($participant);
|
|
$participant->removeSortiesParticipant($this);
|
|
|
|
return $this;
|
|
}
|
|
}
|