HegreLand/src/Entity/Mission.php

153 lines
3.4 KiB
PHP

<?php
namespace App\Entity;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: MissionRepository::class)]
class Mission
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 30)]
private ?string $label = null;
#[ORM\OneToMany(targetEntity: Requirement::class, mappedBy: 'mission')]
#[ORM\JoinColumn(referencedColumnName: 'mission')]
private Collection $requirements;
#[ORM\OneToMany(targetEntity: Employee::class, mappedBy: 'mission')]
private ?Employee $employee = null;
#[ORM\OneToMany(targetEntity: Ride::class, mappedBy: 'mission')]
private ?Ride $ride;
#[ORM\OneToMany(targetEntity: MissionCategory::class, mappedBy: 'mission')]
#[ORM\JoinColumn(referencedColumnName: 'mission')]
private Collection $missionCategories;
public function getRequirements(): Collection
{
return $this->requirements;
}
public function addRequirement(Requirement $requirement): static
{
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;
}
public function getEmployeemissions(): Collection
{
return $this->employeemissions;
}
public function setEmployeemissions(Collection $employeemissions): void
{
$this->employeemissions = $employeemissions;
}
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;
}
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;
}
public function getMissionCategorie(): Collection
{
return $this->missionCategories;
}
public function addMissionCategory(MissionCategory $missionCategory): static
{
if(!$this->missionCategories->contains($missionCategory)) {
$this->missionCategories->add($missionCategory);
$missionCategory->setMission($this);
}
return $this;
}
public function removeMissionCategory(MissionCategory $missionCategory): static
{
if($this->missionCategories->removeElement($missionCategory)) {
if($missionCategory->getMission() === $this) {
$missionCategory->setMission(null);
}
}
return $this;
}
}