src/Entity/Conge.php line 10

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CongeRepository;
  4. use Doctrine\DBAL\Types\Types;
  5. use Doctrine\ORM\Mapping as ORM;
  6. #[ORM\Entity(repositoryClassCongeRepository::class)]
  7. class Conge
  8. {
  9.     #[ORM\Id]
  10.     #[ORM\GeneratedValue]
  11.     #[ORM\Column]
  12.     private ?int $id null;
  13.     #[ORM\ManyToOne(inversedBy'conges')]
  14.     #[ORM\JoinColumn(nullablefalse)]
  15.     private ?Employe $employe null;
  16.     #[ORM\Column(length50)]
  17.     private ?string $typeConge null// Annuel, Maladie, Maternité, Sans solde
  18.     #[ORM\Column(typeTypes::DATE_MUTABLE)]
  19.     private ?\DateTimeInterface $dateDebut null;
  20.     #[ORM\Column(typeTypes::DATE_MUTABLE)]
  21.     private ?\DateTimeInterface $dateFin null;
  22.     #[ORM\Column(typeTypes::INTEGER)]
  23.     private ?int $nombreJours null;
  24.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  25.     private ?string $motif null;
  26.     #[ORM\Column(length50)]
  27.     private ?string $statut 'en_attente'// en_attente, approuvé, refusé, annulé
  28.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  29.     private ?string $commentaireValidation null;
  30.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  31.     private ?\DateTimeInterface $dateValidation null;
  32.     #[ORM\ManyToOne(targetEntityUser::class)]
  33.     private ?User $validePar null;
  34.     #[ORM\Column]
  35.     private ?\DateTimeImmutable $createdAt null;
  36.     #[ORM\Column(length255nullabletrue)]
  37.     private ?string $documentJustificatif null;
  38.     public function __construct()
  39.     {
  40.         $this->createdAt = new \DateTimeImmutable();
  41.     }
  42.     public function getId(): ?int
  43.     {
  44.         return $this->id;
  45.     }
  46.     public function getEmploye(): ?Employe
  47.     {
  48.         return $this->employe;
  49.     }
  50.     public function setEmploye(?Employe $employe): static
  51.     {
  52.         $this->employe $employe;
  53.         return $this;
  54.     }
  55.     public function getTypeConge(): ?string
  56.     {
  57.         return $this->typeConge;
  58.     }
  59.     public function setTypeConge(string $typeConge): static
  60.     {
  61.         $this->typeConge $typeConge;
  62.         return $this;
  63.     }
  64.     public function getDateDebut(): ?\DateTimeInterface
  65.     {
  66.         return $this->dateDebut;
  67.     }
  68.     public function setDateDebut(\DateTimeInterface $dateDebut): static
  69.     {
  70.         $this->dateDebut $dateDebut;
  71.         return $this;
  72.     }
  73.     public function getDateFin(): ?\DateTimeInterface
  74.     {
  75.         return $this->dateFin;
  76.     }
  77.     public function setDateFin(\DateTimeInterface $dateFin): static
  78.     {
  79.         $this->dateFin $dateFin;
  80.         return $this;
  81.     }
  82.     public function getNombreJours(): ?int
  83.     {
  84.         return $this->nombreJours;
  85.     }
  86.     public function setNombreJours(int $nombreJours): static
  87.     {
  88.         $this->nombreJours $nombreJours;
  89.         return $this;
  90.     }
  91.     public function getMotif(): ?string
  92.     {
  93.         return $this->motif;
  94.     }
  95.     public function setMotif(?string $motif): static
  96.     {
  97.         $this->motif $motif;
  98.         return $this;
  99.     }
  100.     public function getStatut(): ?string
  101.     {
  102.         return $this->statut;
  103.     }
  104.     public function setStatut(string $statut): static
  105.     {
  106.         $this->statut $statut;
  107.         return $this;
  108.     }
  109.     public function getCommentaireValidation(): ?string
  110.     {
  111.         return $this->commentaireValidation;
  112.     }
  113.     public function setCommentaireValidation(?string $commentaireValidation): static
  114.     {
  115.         $this->commentaireValidation $commentaireValidation;
  116.         return $this;
  117.     }
  118.     public function getDateValidation(): ?\DateTimeInterface
  119.     {
  120.         return $this->dateValidation;
  121.     }
  122.     public function setDateValidation(?\DateTimeInterface $dateValidation): static
  123.     {
  124.         $this->dateValidation $dateValidation;
  125.         return $this;
  126.     }
  127.     public function getValidePar(): ?User
  128.     {
  129.         return $this->validePar;
  130.     }
  131.     public function setValidePar(?User $validePar): static
  132.     {
  133.         $this->validePar $validePar;
  134.         return $this;
  135.     }
  136.     public function getCreatedAt(): ?\DateTimeImmutable
  137.     {
  138.         return $this->createdAt;
  139.     }
  140.     public function setCreatedAt(\DateTimeImmutable $createdAt): static
  141.     {
  142.         $this->createdAt $createdAt;
  143.         return $this;
  144.     }
  145.     public function getDocumentJustificatif(): ?string
  146.     {
  147.         return $this->documentJustificatif;
  148.     }
  149.     public function setDocumentJustificatif(?string $documentJustificatif): static
  150.     {
  151.         $this->documentJustificatif $documentJustificatif;
  152.         return $this;
  153.     }
  154.     public function calculerNombreJours(): void
  155.     {
  156.         if ($this->dateDebut && $this->dateFin) {
  157.             $this->nombreJours $this->dateDebut->diff($this->dateFin)->days 1;
  158.         }
  159.     }
  160.     public function __toString(): string
  161.     {
  162.         return $this->typeConge ' - ' . ($this->employe $this->employe->getNomComplet() : '');
  163.     }
  164. }