src/Entity/Cycle.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CycleRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Component\Validator\Constraints as Assert;
  9. #[ORM\Entity(repositoryClassCycleRepository::class)]
  10. class Cycle
  11. {
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue]
  14.     #[ORM\Column]
  15.     private ?int $id null;
  16.     #[ORM\Column(length255nullabletrue)]
  17.     #[Assert\NotBlank  (message:"Le champ ne peut pas ĂȘtre vide.")]
  18.     private ?string $libele null;
  19.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  20.     #[Assert\NotBlank (message:"Le champ ne peut pas ĂȘtre vide.")]
  21.     private ?\DateTimeInterface $dateDebut null;
  22.     #[ORM\OneToMany(mappedBy'cycle'targetEntityEngagement::class)]
  23.     private Collection $engagements;
  24.     #[ORM\OneToMany(mappedBy'cycle'targetEntityInscription::class)]
  25.     private Collection $inscriptions;
  26.     #[ORM\Column(nullabletrue)]
  27.     private ?int $etat null;
  28.     public function __construct()
  29.     {
  30.         $this->engagements = new ArrayCollection();
  31.         $this->inscriptions = new ArrayCollection();
  32.     }
  33.     public function __toString()
  34.     {
  35.         return $this->libele;
  36.     }
  37.     public function getId(): ?int
  38.     {
  39.         return $this->id;
  40.     }
  41.     public function getLibele(): ?string
  42.     {
  43.         return $this->libele;
  44.     }
  45.     public function setLibele(?string $libele): self
  46.     {
  47.         $this->libele $libele;
  48.         return $this;
  49.     }
  50.     public function getDateDebut(): ?\DateTimeInterface
  51.     {
  52.         return $this->dateDebut;
  53.     }
  54.     public function setDateDebut(?\DateTimeInterface $dateDebut): self
  55.     {
  56.         $this->dateDebut $dateDebut;
  57.         return $this;
  58.     }
  59.     /**
  60.      * @return Collection<int, Engagement>
  61.      */
  62.     public function getEngagements(): Collection
  63.     {
  64.         return $this->engagements;
  65.     }
  66.     public function addEngagement(Engagement $engagement): self
  67.     {
  68.         if (!$this->engagements->contains($engagement)) {
  69.             $this->engagements->add($engagement);
  70.             $engagement->setCycle($this);
  71.         }
  72.         return $this;
  73.     }
  74.     public function removeEngagement(Engagement $engagement): self
  75.     {
  76.         if ($this->engagements->removeElement($engagement)) {
  77.             // set the owning side to null (unless already changed)
  78.             if ($engagement->getCycle() === $this) {
  79.                 $engagement->setCycle(null);
  80.             }
  81.         }
  82.         return $this;
  83.     }
  84.     /**
  85.      * @return Collection<int, Inscription>
  86.      */
  87.     public function getInscriptions(): Collection
  88.     {
  89.         return $this->inscriptions;
  90.     }
  91.     public function addInscription(Inscription $inscription): self
  92.     {
  93.         if (!$this->inscriptions->contains($inscription)) {
  94.             $this->inscriptions->add($inscription);
  95.             $inscription->setCycle($this);
  96.         }
  97.         return $this;
  98.     }
  99.     public function removeInscription(Inscription $inscription): self
  100.     {
  101.         if ($this->inscriptions->removeElement($inscription)) {
  102.             // set the owning side to null (unless already changed)
  103.             if ($inscription->getCycle() === $this) {
  104.                 $inscription->setCycle(null);
  105.             }
  106.         }
  107.         return $this;
  108.     }
  109.     public function getEtat(): ?int
  110.     {
  111.         return $this->etat;
  112.     }
  113.     public function setEtat(?int $etat): static
  114.     {
  115.         $this->etat $etat;
  116.         return $this;
  117.     }
  118. }