<?php
namespace App\Entity;
use App\Repository\SiteCategoryRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=SiteCategoryRepository::class)
*/
class SiteCategory
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $title;
/**
* @ORM\Column(type="string", length=255)
*/
private $icon;
/**
* @ORM\OneToMany(targetEntity=Site::class, mappedBy="siteCategory")
*/
private $sites;
public function __construct()
{
$this->sites = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(string $title): self
{
$this->title = $title;
return $this;
}
public function getIcon(): ?string
{
return $this->icon;
}
public function setIcon(string $icon): self
{
$this->icon = $icon;
return $this;
}
/**
* @return Collection<int, Site>
*/
public function getSites(): Collection
{
return $this->sites;
}
public function addSite(Site $site): self
{
if (!$this->sites->contains($site)) {
$this->sites[] = $site;
$site->setSiteCategory($this);
}
return $this;
}
public function removeSite(Site $site): self
{
if ($this->sites->removeElement($site)) {
// set the owning side to null (unless already changed)
if ($site->getSiteCategory() === $this) {
$site->setSiteCategory(null);
}
}
return $this;
}
}