<?php
namespace App\Entity;
use App\Repository\ReportTypeRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ReportTypeRepository::class)]
class ReportType
{
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'AUTO')]
#[ORM\Column(type: 'integer', unique: true)]
private $id;
#[ORM\Column(type: 'string', length: 255)]
private $name;
#[ORM\OneToMany(targetEntity: Report::class, mappedBy: 'reportType')]
private $reports;
public function __construct()
{
$this->reports = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
/**
* @return Collection|Report[]
*/
public function getReports(): Collection
{
return $this->reports;
}
public function addReport(Report $report): self
{
if (!$this->reports->contains($report)) {
$this->reports[] = $report;
$report->setReportType($this);
}
return $this;
}
public function removeReport(Report $report): self
{
if ($this->reports->removeElement($report)) {
// set the owning side to null (unless already changed)
if ($report->getReportType() === $this) {
$report->setReportType(null);
}
}
return $this;
}
}