<?phpnamespace App\Entity;use App\Repository\PosteRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: PosteRepository::class)]class Poste{ #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] private ?int $id = null; #[ORM\Column(length: 100)] private ?string $titre = null; #[ORM\Column(length: 500, nullable: true)] private ?string $description = null; #[ORM\Column(type: 'decimal', precision: 10, scale: 2, nullable: true)] private ?string $salaireMin = null; #[ORM\Column(type: 'decimal', precision: 10, scale: 2, nullable: true)] private ?string $salaireMax = null; #[ORM\Column] private ?\DateTimeImmutable $createdAt = null; #[ORM\OneToMany(mappedBy: 'poste', targetEntity: Employe::class)] private Collection $employes; #[ORM\Column] private ?bool $estActif = true; public function __construct() { $this->employes = new ArrayCollection(); $this->createdAt = new \DateTimeImmutable(); } public function getId(): ?int { return $this->id; } public function getTitre(): ?string { return $this->titre; } public function setTitre(string $titre): static { $this->titre = $titre; return $this; } public function getDescription(): ?string { return $this->description; } public function setDescription(?string $description): static { $this->description = $description; return $this; } public function getSalaireMin(): ?string { return $this->salaireMin; } public function setSalaireMin(?string $salaireMin): static { $this->salaireMin = $salaireMin; return $this; } public function getSalaireMax(): ?string { return $this->salaireMax; } public function setSalaireMax(?string $salaireMax): static { $this->salaireMax = $salaireMax; return $this; } public function getCreatedAt(): ?\DateTimeImmutable { return $this->createdAt; } public function setCreatedAt(\DateTimeImmutable $createdAt): static { $this->createdAt = $createdAt; return $this; } /** * @return Collection<int, Employe> */ public function getEmployes(): Collection { return $this->employes; } public function addEmploye(Employe $employe): static { if (!$this->employes->contains($employe)) { $this->employes->add($employe); $employe->setPoste($this); } return $this; } public function removeEmploye(Employe $employe): static { if ($this->employes->removeElement($employe)) { if ($employe->getPoste() === $this) { $employe->setPoste(null); } } return $this; } public function isEstActif(): ?bool { return $this->estActif; } public function setEstActif(bool $estActif): static { $this->estActif = $estActif; return $this; } public function __toString(): string { return $this->titre ?? ''; }}