src/Entity/Poste.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\PosteRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassPosteRepository::class)]
  8. class Poste
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column]
  13.     private ?int $id null;
  14.     #[ORM\Column(length100)]
  15.     private ?string $titre null;
  16.     #[ORM\Column(length500nullabletrue)]
  17.     private ?string $description null;
  18.     #[ORM\Column(type'decimal'precision10scale2nullabletrue)]
  19.     private ?string $salaireMin null;
  20.     #[ORM\Column(type'decimal'precision10scale2nullabletrue)]
  21.     private ?string $salaireMax null;
  22.     #[ORM\Column]
  23.     private ?\DateTimeImmutable $createdAt null;
  24.     #[ORM\OneToMany(mappedBy'poste'targetEntityEmploye::class)]
  25.     private Collection $employes;
  26.     #[ORM\Column]
  27.     private ?bool $estActif true;
  28.     public function __construct()
  29.     {
  30.         $this->employes = new ArrayCollection();
  31.         $this->createdAt = new \DateTimeImmutable();
  32.     }
  33.     public function getId(): ?int
  34.     {
  35.         return $this->id;
  36.     }
  37.     public function getTitre(): ?string
  38.     {
  39.         return $this->titre;
  40.     }
  41.     public function setTitre(string $titre): static
  42.     {
  43.         $this->titre $titre;
  44.         return $this;
  45.     }
  46.     public function getDescription(): ?string
  47.     {
  48.         return $this->description;
  49.     }
  50.     public function setDescription(?string $description): static
  51.     {
  52.         $this->description $description;
  53.         return $this;
  54.     }
  55.     public function getSalaireMin(): ?string
  56.     {
  57.         return $this->salaireMin;
  58.     }
  59.     public function setSalaireMin(?string $salaireMin): static
  60.     {
  61.         $this->salaireMin $salaireMin;
  62.         return $this;
  63.     }
  64.     public function getSalaireMax(): ?string
  65.     {
  66.         return $this->salaireMax;
  67.     }
  68.     public function setSalaireMax(?string $salaireMax): static
  69.     {
  70.         $this->salaireMax $salaireMax;
  71.         return $this;
  72.     }
  73.     public function getCreatedAt(): ?\DateTimeImmutable
  74.     {
  75.         return $this->createdAt;
  76.     }
  77.     public function setCreatedAt(\DateTimeImmutable $createdAt): static
  78.     {
  79.         $this->createdAt $createdAt;
  80.         return $this;
  81.     }
  82.     /**
  83.      * @return Collection<int, Employe>
  84.      */
  85.     public function getEmployes(): Collection
  86.     {
  87.         return $this->employes;
  88.     }
  89.     public function addEmploye(Employe $employe): static
  90.     {
  91.         if (!$this->employes->contains($employe)) {
  92.             $this->employes->add($employe);
  93.             $employe->setPoste($this);
  94.         }
  95.         return $this;
  96.     }
  97.     public function removeEmploye(Employe $employe): static
  98.     {
  99.         if ($this->employes->removeElement($employe)) {
  100.             if ($employe->getPoste() === $this) {
  101.                 $employe->setPoste(null);
  102.             }
  103.         }
  104.         return $this;
  105.     }
  106.     public function isEstActif(): ?bool
  107.     {
  108.         return $this->estActif;
  109.     }
  110.     public function setEstActif(bool $estActif): static
  111.     {
  112.         $this->estActif $estActif;
  113.         return $this;
  114.     }
  115.     public function __toString(): string
  116.     {
  117.         return $this->titre ?? '';
  118.     }
  119. }