<?php
namespace App\Entity;
use App\Repository\PrestationRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: PrestationRepository::class)]
class Prestation
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'string', length: 255)]
private $libelle;
#[ORM\ManyToOne(inversedBy: 'prestations')]
#[ORM\JoinColumn(nullable: false)]
private ?Rubrique $rubrique = null;
#[ORM\OneToMany(mappedBy: 'prestation', targetEntity: Module::class, orphanRemoval: true, cascade: ['persist', 'remove'])]
private Collection $modules;
#[ORM\OneToMany(mappedBy: 'prestation', targetEntity: DemandeService::class)]
private Collection $demandeServices;
#[ORM\OneToMany(mappedBy: 'cycle', targetEntity: GroupeDemande::class, orphanRemoval: true)]
private Collection $groupeDemandes;
public function __construct()
{
$this->modules = new ArrayCollection();
$this->demandeServices = new ArrayCollection();
$this->groupeDemandes = new ArrayCollection();
}
public function __toString()
{
return $this->libelle;
}
public function getId(): ?int
{
return $this->id;
}
public function getLibelle(): ?string
{
return $this->libelle;
}
public function setLibelle(string $libelle): self
{
$this->libelle = $libelle;
return $this;
}
public function getRubrique(): ?Rubrique
{
return $this->rubrique;
}
public function setRubrique(?Rubrique $rubrique): self
{
$this->rubrique = $rubrique;
return $this;
}
/**
* @return Collection<int, Module>
*/
public function getModules(): Collection
{
return $this->modules;
}
public function addModule(Module $module): self
{
if (!$this->modules->contains($module)) {
$this->modules->add($module);
$module->setPrestation($this);
}
return $this;
}
public function removeModule(Module $module): self
{
if ($this->modules->removeElement($module)) {
// set the owning side to null (unless already changed)
if ($module->getPrestation() === $this) {
$module->setPrestation(null);
}
}
return $this;
}
/**
* @return Collection<int, DemandeService>
*/
public function getDemandeServices(): Collection
{
return $this->demandeServices;
}
public function addDemandeService(DemandeService $demandeService): self
{
if (!$this->demandeServices->contains($demandeService)) {
$this->demandeServices->add($demandeService);
$demandeService->setPrestation($this);
}
return $this;
}
public function removeDemandeService(DemandeService $demandeService): self
{
if ($this->demandeServices->removeElement($demandeService)) {
// set the owning side to null (unless already changed)
if ($demandeService->getPrestation() === $this) {
$demandeService->setPrestation(null);
}
}
return $this;
}
/**
* @return Collection<int, GroupeDemande>
*/
public function getGroupeDemandes(): Collection
{
return $this->groupeDemandes;
}
public function addGroupeDemande(GroupeDemande $groupeDemande): self
{
if (!$this->groupeDemandes->contains($groupeDemande)) {
$this->groupeDemandes->add($groupeDemande);
$groupeDemande->setCycle($this);
}
return $this;
}
public function removeGroupeDemande(GroupeDemande $groupeDemande): self
{
if ($this->groupeDemandes->removeElement($groupeDemande)) {
// set the owning side to null (unless already changed)
if ($groupeDemande->getCycle() === $this) {
$groupeDemande->setCycle(null);
}
}
return $this;
}
}