Base du projet 'application ticketing'
This commit is contained in:
83
backend/src/Entity/RequestStatus.php
Normal file
83
backend/src/Entity/RequestStatus.php
Normal file
@ -0,0 +1,83 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user