HegreLand/src/Entity/Mission.php

153 lines
3.4 KiB
PHP
Raw Normal View History

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: MissionRepository::class)]
2024-09-26 15:49:16 +02:00
class Mission
{
#[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: Requirement::class, mappedBy: 'mission')]
#[ORM\JoinColumn(referencedColumnName: 'mission')]
2024-10-03 17:27:42 +02:00
private Collection $requirements;
#[ORM\OneToMany(targetEntity: Employee::class, mappedBy: 'mission')]
2024-10-17 14:33:38 +02:00
private ?Employee $employee = null;
2024-10-03 17:27:42 +02:00
#[ORM\OneToMany(targetEntity: Ride::class, mappedBy: 'mission')]
private ?Ride $ride;
2024-10-17 14:33:38 +02:00
#[ORM\OneToMany(targetEntity: MissionCategory::class, mappedBy: 'mission')]
#[ORM\JoinColumn(referencedColumnName: 'mission')]
private Collection $missionCategories;
2024-10-03 17:27:42 +02:00
public function getRequirements(): Collection
{
return $this->requirements;
}
2024-10-17 14:33:38 +02:00
public function addRequirement(Requirement $requirement): static
2024-10-03 17:27:42 +02:00
{
2024-10-17 14:33:38 +02:00
if(!$this->requirements->contains($requirement)) {
$this->requirements->add($requirement);
$requirement->setMission($this);
}
return $this;
}
public function removeRequirement(Requirement $requirement): static
{
if($this->requirements->removeElement($requirement)) {
if($requirement->getMission() === $this) {
$requirement->setMission(null);
}
}
return $this;
2024-10-03 17:27:42 +02:00
}
public function getEmployeemissions(): Collection
{
return $this->employeemissions;
}
public function setEmployeemissions(Collection $employeemissions): void
{
$this->employeemissions = $employeemissions;
}
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 getEmployee(): ?employee
{
return $this->employee;
}
public function setEmployee(?employee $employee): void
{
$this->employee = $employee;
}
public function getCategories(): Collection
{
return $this->categories;
}
public function setCategories(Collection $categories): void
{
$this->categories = $categories;
}
public function getRide(): ?Ride
{
return $this->ride;
}
public function setRide(?Ride $ride): void
{
$this->ride = $ride;
}
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->setMission($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->getMission() === $this) {
$missionCategory->setMission(null);
}
}
2024-10-03 17:27:42 +02:00
2024-10-17 14:33:38 +02:00
return $this;
}
2024-09-26 15:49:16 +02:00
}
2024-10-03 17:27:42 +02:00