<?php
namespace App\Entity\Otpusk;
use App\Repository\Otpusk\GeoCategoryRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=GeoCategoryRepository::class)
*/
class GeoCategory
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=1024, nullable=false)
*/
private $name;
/**
* @var Collection|GeoCategoryValues[]
* @ORM\OneToMany(targetEntity="App\Entity\Otpusk\GeoCategoryValues", mappedBy="category", cascade={"persist"}, orphanRemoval=true)
*/
private $values;
public function __construct()
{
$this->values = 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|GeoCategoryValues[]
*/
public function getValues(): Collection
{
return $this->values;
}
public function addValue(GeoCategoryValues $value): self
{
if (!$this->values->contains($value)) {
$this->values[] = $value;
$value->setSelection($this);
}
return $this;
}
public function removeValue(GeoCategoryValues $value): self
{
if ($this->values->contains($value)) {
$this->values->removeElement($value);
if ($value->getSelection() === $this) {
$value->setSelection(null);
}
}
return $this;
}
public function __toString()
{
return $this->getName();
}
}