<?phpnamespace App\Entity;use App\Repository\CategorieRepository;use App\Util\Status;use Cocur\Slugify\Slugify;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;/** * @ORM\Entity(repositoryClass=CategorieRepository::class) */class Categorie{ /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="text") */ private $nom; /** * @ORM\Column(type="integer") */ private $statut; /** * @ORM\Column(type="text", nullable=true) */ private $notes; /** * @ORM\OneToMany(targetEntity=Prestation::class, mappedBy="categorie") */ private $prestations; /** * @ORM\Column(type="text", nullable=true) */ private $details; public function __construct() { $this->prestations = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getNom(): ?string { return $this->nom; } public function setNom(string $nom): self { $this->nom = $nom; return $this; } public function getStatut(): ?int { return $this->statut; } public function setStatut(int $statut): self { $this->statut = $statut; return $this; } public function getNotes(): ?string { return $this->notes; } public function setNotes(?string $notes): self { $this->notes = $notes; return $this; } /** * @return Collection<int, Prestation> */ public function getPrestations(): Collection { return $this->prestations; } public function addPrestation(Prestation $prestation): self { if (!$this->prestations->contains($prestation)) { $this->prestations[] = $prestation; $prestation->setCategorie($this); } return $this; } public function removePrestation(Prestation $prestation): self { if ($this->prestations->removeElement($prestation)) { // set the owning side to null (unless already changed) if ($prestation->getCategorie() === $this) { $prestation->setCategorie(null); } } return $this; } public function isValid(): bool{ return $this->getStatut() == Status::VALID; } public function getSlug() { return (new Slugify())->slugify($this->getNom()) ; } public function getDetails(): ?string { return $this->details; } public function setDetails(?string $details): self { $this->details = $details; return $this; }}