<?php
namespace App\Entity;
use App\Repository\ParameterCategoryRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ParameterCategoryRepository::class)]
class ParameterCategory
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $name;
#[ORM\OneToMany(targetEntity: Parameter::class, mappedBy: 'parameterCategory')]
private $parameters;
public function __construct()
{
$this->parameters = 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|Parameter[]
*/
public function getParameters(): Collection
{
return $this->parameters;
}
public function addParameter(Parameter $parameter): self
{
if (!$this->parameters->contains($parameter)) {
$this->parameters[] = $parameter;
$parameter->setParameterCategory($this);
}
return $this;
}
public function removeParameter(Parameter $parameter): self
{
if ($this->parameters->removeElement($parameter)) {
// set the owning side to null (unless already changed)
if ($parameter->getParameterCategory() === $this) {
$parameter->setParameterCategory(null);
}
}
return $this;
}
}