react-logo/backend/src/Entity/RequestStatus.php

84 lines
1.7 KiB
PHP

<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="App\Repository\RequestStatusRepository")
*/
class RequestStatus
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=64)
*/
private $label;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Request", mappedBy="status")
*/
private $requests;
public function __construct()
{
$this->requests = new ArrayCollection();
}
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|Request[]
*/
public function getRequests(): Collection
{
return $this->requests;
}
public function addRequest(Request $request): self
{
if (!$this->requests->contains($request)) {
$this->requests[] = $request;
$request->setStatus($this);
}
return $this;
}
public function removeRequest(Request $request): self
{
if ($this->requests->contains($request)) {
$this->requests->removeElement($request);
// set the owning side to null (unless already changed)
if ($request->getStatus() === $this) {
$request->setStatus(null);
}
}
return $this;
}
}