<?phpnamespace App\Entity;use App\Repository\CycleRepository;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: CycleRepository::class)]class Cycle{ #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] private ?int $id = null; #[ORM\Column(length: 255, nullable: true)] #[Assert\NotBlank (message:"Le champ ne peut pas ĂȘtre vide.")] private ?string $libele = null; #[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)] #[Assert\NotBlank (message:"Le champ ne peut pas ĂȘtre vide.")] private ?\DateTimeInterface $dateDebut = null; #[ORM\OneToMany(mappedBy: 'cycle', targetEntity: Engagement::class)] private Collection $engagements; #[ORM\OneToMany(mappedBy: 'cycle', targetEntity: Inscription::class)] private Collection $inscriptions; #[ORM\Column(nullable: true)] private ?int $etat = null; public function __construct() { $this->engagements = new ArrayCollection(); $this->inscriptions = new ArrayCollection(); } public function __toString() { return $this->libele; } public function getId(): ?int { return $this->id; } public function getLibele(): ?string { return $this->libele; } public function setLibele(?string $libele): self { $this->libele = $libele; return $this; } public function getDateDebut(): ?\DateTimeInterface { return $this->dateDebut; } public function setDateDebut(?\DateTimeInterface $dateDebut): self { $this->dateDebut = $dateDebut; return $this; } /** * @return Collection<int, Engagement> */ public function getEngagements(): Collection { return $this->engagements; } public function addEngagement(Engagement $engagement): self { if (!$this->engagements->contains($engagement)) { $this->engagements->add($engagement); $engagement->setCycle($this); } return $this; } public function removeEngagement(Engagement $engagement): self { if ($this->engagements->removeElement($engagement)) { // set the owning side to null (unless already changed) if ($engagement->getCycle() === $this) { $engagement->setCycle(null); } } return $this; } /** * @return Collection<int, Inscription> */ public function getInscriptions(): Collection { return $this->inscriptions; } public function addInscription(Inscription $inscription): self { if (!$this->inscriptions->contains($inscription)) { $this->inscriptions->add($inscription); $inscription->setCycle($this); } return $this; } public function removeInscription(Inscription $inscription): self { if ($this->inscriptions->removeElement($inscription)) { // set the owning side to null (unless already changed) if ($inscription->getCycle() === $this) { $inscription->setCycle(null); } } return $this; } public function getEtat(): ?int { return $this->etat; } public function setEtat(?int $etat): static { $this->etat = $etat; return $this; }}