148 lines
3.2 KiB
PHP
148 lines
3.2 KiB
PHP
<?php
|
|
|
|
namespace App\Entity;
|
|
|
|
use App\Repository\RideRepository;
|
|
use Doctrine\Common\Collections\Collection;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
#[ORM\Entity(repositoryClass: RideRepository::class)]
|
|
class Ride
|
|
{
|
|
#[ORM\Id]
|
|
#[ORM\GeneratedValue]
|
|
#[ORM\Column]
|
|
private ?int $id = null;
|
|
|
|
#[ORM\Column(length: 30)]
|
|
private ?string $label = null;
|
|
|
|
#[ORM\Column]
|
|
private ?int $count = null;
|
|
|
|
#[ORM\OneToMany(targetEntity: Assignment::class, mappedBy: 'ride')]
|
|
private Collection $assignments;
|
|
|
|
#[ORM\OneToMany(targetEntity: Representation::class, mappedBy: 'ride')]
|
|
private Collection $representations;
|
|
|
|
#[ORM\OneToMany(targetEntity: Incident::class, mappedBy: 'ride')]
|
|
private Collection $incidents;
|
|
|
|
#[ORM\OneToMany(targetEntity: Mission::class, mappedBy: 'ride')]
|
|
private Collection $missions;
|
|
|
|
public function getAssignments(): Collection
|
|
{
|
|
return $this->assignments;
|
|
}
|
|
|
|
public function addAssigment(Assignment $assignment): static
|
|
{
|
|
if(!$this->assignments->contains($assignment)) {
|
|
$this->assignments->add($assignment);
|
|
$assignment->setRide($this);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function removeAssigment(Assignment $assignment): static
|
|
{
|
|
if($this->assignments->removeElement($assignment)) {
|
|
if($assignment->getRide() === $this) {
|
|
$assignment->setRide(null);
|
|
}
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getRepresentations(): Collection
|
|
{
|
|
return $this->incidents;
|
|
}
|
|
|
|
public function addRepresentation(Representation $representation): static
|
|
{
|
|
if(!$this->representations->contains($representation)) {
|
|
$this->representations->add($representation);
|
|
$representation->setRide($this);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function removeRepresentation(Representation $representation): static
|
|
{
|
|
if($this->representations->removeElement($representation)) {
|
|
if($representation->getRide() === $this) {
|
|
$representation->setRide(null);
|
|
}
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
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 getCount(): ?int
|
|
{
|
|
return $this->count;
|
|
}
|
|
|
|
public function setCount(int $count): static
|
|
{
|
|
$this->count = $count;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getMissions(): Collection
|
|
{
|
|
return $this->missions;
|
|
}
|
|
|
|
public function setMissions(Collection $missions): void
|
|
{
|
|
$this->missions = $missions;
|
|
}
|
|
|
|
public function getIncidents(): Collection
|
|
{
|
|
return $this->incidents;
|
|
}
|
|
|
|
public function setIncidents(Collection $incidents): void
|
|
{
|
|
$this->incidents = $incidents;
|
|
}
|
|
|
|
public function __toString(): string
|
|
{
|
|
return $this->label;
|
|
}
|
|
}
|