<?php
namespace App\Entity;
use App\Repository\TaxonomyRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=TaxonomyRepository::class)
*/
class Taxonomy extends BaseEntity
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\ManyToMany(targetEntity=Module::class, mappedBy="taxonomies")
*/
private $modules;
public function __construct()
{
$this->modules = 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<int, Module>
*/
public function getModules(): Collection
{
return $this->modules;
}
public function addModule(Module $module): self
{
if (!$this->modules->contains($module)) {
$this->modules[] = $module;
$module->addTaxonomy($this);
}
return $this;
}
public function removeModule(Module $module): self
{
if ($this->modules->removeElement($module)) {
$module->removeTaxonomy($this);
}
return $this;
}
}