<?phpnamespace App\Entity;use App\Entity\Traits\HashTrait;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\Persistence\Event\LifecycleEventArgs;use Doctrine\ORM\Mapping as ORM;/** * @ORM\HasLifecycleCallbacks() * @ORM\Entity(repositoryClass="App\Repository\LanguageRepository") */class Language{ use HashTrait; /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private int $id; /** * @ORM\Column(type="string", length=25) */ private string $name; /** * @ORM\Column(type="string", length=2, options={"comment":"ISO-639-1"}) */ private string $code; /** * @var ArrayCollection|Headquarter[] * * @ORM\ManyToMany(targetEntity="App\Entity\Headquarter", mappedBy="languages") */ private $headquarters; public function __construct() { $this->headquarters = 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; } public function getCode(): ?string { return $this->code; } public function setCode(string $code): self { $this->code = $code; return $this; } /** * @return Collection|Headquarter[] */ public function getHeadquarters(): Collection { return $this->headquarters; } public function addHeadquarters(Headquarter $headquarters): self { if (!$this->headquarters->contains($headquarters)) { $this->headquarters[] = $headquarters; $headquarters->addLanguage($this); } return $this; } public function removeHeadquarters(Headquarter $headquarters): self { if ($this->headquarters->removeElement($headquarters)) { $headquarters->removeLanguage($this); } return $this; }}