src/Entity/Mois.php line 12

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\MoisRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassMoisRepository::class)]
  8. class Mois
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column]
  13.     private ?int $id null;
  14.     #[ORM\Column(length100nullabletrue)]
  15.     private ?string $libelle null;
  16.     #[ORM\ManyToOne(inversedBy'mois')]
  17.     private ?Annee $annee null;
  18.     #[ORM\Column(length5nullabletrue)]
  19.     private ?string $name null;
  20.     #[ORM\Column]
  21.     private ?bool $isGenerate null;
  22.     #[ORM\ManyToMany(targetEntityPayment::class, mappedBy'mois')]
  23.     private Collection $payments;
  24.     #[ORM\OneToMany(mappedBy'month'targetEntityPaymentGenerator::class)]
  25.     private Collection $paymentGenerators;
  26.     public function __construct()
  27.     {
  28.         $this->payments = new ArrayCollection();
  29.         $this->paymentGenerators = new ArrayCollection();
  30.     }
  31.     /**
  32.      * @return int|null
  33.      */
  34.     public function getId(): ?int
  35.     {
  36.         return $this->id;
  37.     }
  38.     /**
  39.      * @param int|null $id
  40.      */
  41.     public function setId(?int $id): void
  42.     {
  43.         $this->id $id;
  44.     }
  45.     /**
  46.      * @return string|null
  47.      */
  48.     public function getLibelle(): ?string
  49.     {
  50.         return $this->libelle;
  51.     }
  52.     /**
  53.      * @param string|null $libelle
  54.      */
  55.     public function setLibelle(?string $libelle): void
  56.     {
  57.         $this->libelle $libelle;
  58.     }
  59.     /**
  60.      * @return Annee|null
  61.      */
  62.     public function getAnnee(): ?Annee
  63.     {
  64.         return $this->annee;
  65.     }
  66.     /**
  67.      * @param Annee|null $annee
  68.      */
  69.     public function setAnnee(?Annee $annee): void
  70.     {
  71.         $this->annee $annee;
  72.     }
  73.     /**
  74.      * @return string|null
  75.      */
  76.     public function getName(): ?string
  77.     {
  78.         return $this->name;
  79.     }
  80.     /**
  81.      * @param string|null $name
  82.      */
  83.     public function setName(?string $name): void
  84.     {
  85.         $this->name $name;
  86.     }
  87.     /**
  88.      * @return bool|null
  89.      */
  90.     public function getIsGenerate(): ?bool
  91.     {
  92.         return $this->isGenerate;
  93.     }
  94.     /**
  95.      * @param bool|null $isGenerate
  96.      */
  97.     public function setIsGenerate(?bool $isGenerate): void
  98.     {
  99.         $this->isGenerate $isGenerate;
  100.     }
  101.     public function __toString()
  102.     {
  103.         return $this->libelle;
  104.     }
  105.     /**
  106.      * @return Collection<int, Payment>
  107.      */
  108.     public function getPayments(): Collection
  109.     {
  110.         return $this->payments;
  111.     }
  112.     public function addPayment(Payment $payment): static
  113.     {
  114.         if (!$this->payments->contains($payment)) {
  115.             $this->payments->add($payment);
  116.             $payment->addMoi($this);
  117.         }
  118.         return $this;
  119.     }
  120.     public function removePayment(Payment $payment): static
  121.     {
  122.         if ($this->payments->removeElement($payment)) {
  123.             $payment->removeMoi($this);
  124.         }
  125.         return $this;
  126.     }
  127.     /**
  128.      * @return Collection<int, PaymentGenerator>
  129.      */
  130.     public function getPaymentGenerators(): Collection
  131.     {
  132.         return $this->paymentGenerators;
  133.     }
  134.     public function addPaymentGenerator(PaymentGenerator $paymentGenerator): static
  135.     {
  136.         if (!$this->paymentGenerators->contains($paymentGenerator)) {
  137.             $this->paymentGenerators->add($paymentGenerator);
  138.             $paymentGenerator->setMonth($this);
  139.         }
  140.         return $this;
  141.     }
  142.     public function removePaymentGenerator(PaymentGenerator $paymentGenerator): static
  143.     {
  144.         if ($this->paymentGenerators->removeElement($paymentGenerator)) {
  145.             // set the owning side to null (unless already changed)
  146.             if ($paymentGenerator->getMonth() === $this) {
  147.                 $paymentGenerator->setMonth(null);
  148.             }
  149.         }
  150.         return $this;
  151.     }
  152. }