<?php
namespace App\Entity;
use App\Repository\StakeholderCategoryRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: StakeholderCategoryRepository::class)]
class StakeholderCategory
{
const CUSTOMER_SLUG = "customer";
const COLLABORATOR_SLUG = "collaborator";
const PARTNER_SLUG = "partner";
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'string', length: 255)]
private $name;
#[ORM\Column(type: 'string', length: 255)]
private $slug;
#[ORM\OneToMany(mappedBy: 'stakeholderCategory', targetEntity: Stakeholder::class, orphanRemoval: true)]
private $stakeholders;
public function __construct()
{
$this->stakeholders = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(string $slug): self
{
$this->slug = $slug;
return $this;
}
/**
* @return Collection<int, Stakeholder>
*/
public function getStakeholders(): Collection
{
return $this->stakeholders;
}
public function addStakeholder(Stakeholder $stakeholder): self
{
if (!$this->stakeholders->contains($stakeholder)) {
$this->stakeholders[] = $stakeholder;
$stakeholder->setStakeholderCategory($this);
}
return $this;
}
public function removeStakeholder(Stakeholder $stakeholder): self
{
if ($this->stakeholders->removeElement($stakeholder)) {
// set the owning side to null (unless already changed)
if ($stakeholder->getStakeholderCategory() === $this) {
$stakeholder->setStakeholderCategory(null);
}
}
return $this;
}
}