2024-09-26 15:36:56 +02:00
|
|
|
<?php
|
2024-09-26 15:49:16 +02:00
|
|
|
|
|
|
|
namespace App\Entity;
|
|
|
|
|
|
|
|
|
2024-10-03 17:27:42 +02:00
|
|
|
use Doctrine\Common\Collections\Collection;
|
2024-09-26 15:49:16 +02:00
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
|
2024-11-21 14:44:18 +01:00
|
|
|
#[ORM\Entity(repositoryClass: CategoryRepository::class)]
|
2024-09-26 15:49:16 +02:00
|
|
|
class Category
|
|
|
|
{
|
|
|
|
#[ORM\Id]
|
|
|
|
#[ORM\GeneratedValue]
|
|
|
|
#[ORM\Column]
|
|
|
|
private ?int $id = null;
|
|
|
|
|
|
|
|
#[ORM\Column(length: 30)]
|
|
|
|
private ?string $label = null;
|
|
|
|
|
2024-10-17 14:33:38 +02:00
|
|
|
#[ORM\OneToMany(targetEntity: MissionCategory::class, mappedBy: 'category')]
|
|
|
|
private Collection $missionCategories;
|
2024-10-03 17:27:42 +02:00
|
|
|
|
2024-09-26 15:49:16 +02:00
|
|
|
public function getId(): ?int
|
|
|
|
{
|
|
|
|
return $this->id;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setId(int $id): static
|
|
|
|
{
|
|
|
|
$this->id = $id;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getLabel(): ?string
|
|
|
|
{
|
|
|
|
return $this->label;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setLabel(string $label): static
|
|
|
|
{
|
|
|
|
$this->label = $label;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2024-10-03 17:27:42 +02:00
|
|
|
public function getMission(): ?Mission
|
|
|
|
{
|
|
|
|
return $this->mission;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setMission(?Mission $mission): void
|
|
|
|
{
|
|
|
|
$this->mission = $mission;
|
|
|
|
}
|
|
|
|
|
2024-10-17 14:33:38 +02:00
|
|
|
public function getMissionCategorie(): Collection
|
2024-10-03 17:27:42 +02:00
|
|
|
{
|
2024-10-17 14:33:38 +02:00
|
|
|
return $this->missionCategories;
|
2024-10-03 17:27:42 +02:00
|
|
|
}
|
|
|
|
|
2024-10-17 14:33:38 +02:00
|
|
|
public function addMissionCategory(MissionCategory $missionCategory): static
|
2024-10-03 17:27:42 +02:00
|
|
|
{
|
2024-10-17 14:33:38 +02:00
|
|
|
if(!$this->missionCategories->contains($missionCategory)) {
|
|
|
|
$this->missionCategories->add($missionCategory);
|
|
|
|
$missionCategory->setCategory($this);
|
|
|
|
}
|
2024-10-03 17:27:42 +02:00
|
|
|
|
2024-10-17 14:33:38 +02:00
|
|
|
return $this;
|
|
|
|
}
|
2024-10-03 17:27:42 +02:00
|
|
|
|
2024-10-17 14:33:38 +02:00
|
|
|
public function removeMissionCategory(MissionCategory $missionCategory): static
|
|
|
|
{
|
|
|
|
if($this->missionCategories->removeElement($missionCategory)) {
|
|
|
|
if($missionCategory->getCategory() === $this) {
|
|
|
|
$missionCategory->setCategory(null);
|
|
|
|
}
|
|
|
|
}
|
2024-10-03 17:27:42 +02:00
|
|
|
|
2024-10-17 14:33:38 +02:00
|
|
|
return $this;
|
|
|
|
}
|
2024-10-03 17:27:42 +02:00
|
|
|
|
2024-09-26 15:49:16 +02:00
|
|
|
}
|
2024-10-03 17:27:42 +02:00
|
|
|
|