suivi/src/Entity/ThemeType.php
2022-12-19 18:35:10 +01:00

116 lines
2.8 KiB
PHP

<?php
namespace App\Entity;
use App\Core\Entity\EntityInterface;
use App\Repository\ThemeTypeRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ThemeTypeRepository::class)]
class ThemeType implements EntityInterface
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
protected $id;
#[ORM\Column(type: 'string', length: 255)]
protected $label;
#[ORM\OneToMany(targetEntity: Conference::class, mappedBy: 'themeType', orphanRemoval: true)]
protected $conferences;
#[ORM\OneToMany(targetEntity: Intervention::class, mappedBy: 'themeType', orphanRemoval: true)]
protected $interventions;
public function __construct()
{
$this->conferences = new ArrayCollection();
$this->interventions = new ArrayCollection();
}
public function __toString()
{
return (string) $this->getLabel();
}
public function getId(): ?int
{
return $this->id;
}
public function getLabel(): ?string
{
return $this->label;
}
public function setLabel(string $label): self
{
$this->label = $label;
return $this;
}
/**
* @return Collection<int, Conference>
*/
public function getConferences(): Collection
{
return $this->conferences;
}
public function addConference(Conference $conference): self
{
if (!$this->conferences->contains($conference)) {
$this->conferences[] = $conference;
$conference->setThemeType($this);
}
return $this;
}
public function removeConference(Conference $conference): self
{
if ($this->conferences->removeElement($conference)) {
// set the owning side to null (unless already changed)
if ($conference->getThemeType() === $this) {
$conference->setThemeType(null);
}
}
return $this;
}
/**
* @return Collection<int, Intervention>
*/
public function getInterventions(): Collection
{
return $this->interventions;
}
public function addIntervention(Intervention $intervention): self
{
if (!$this->interventions->contains($intervention)) {
$this->interventions[] = $intervention;
$intervention->setThemeType($this);
}
return $this;
}
public function removeIntervention(Intervention $intervention): self
{
if ($this->interventions->removeElement($intervention)) {
// set the owning side to null (unless already changed)
if ($intervention->getThemeType() === $this) {
$intervention->setThemeType(null);
}
}
return $this;
}
}