<?php
declare(strict_types=1);
namespace App\Entity;
use App\Repository\DomainLangRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=DomainLangRepository::class)
*/
class DomainLang
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\Column(type="string", length=255)
*/
private $slug;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $main;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $active;
/**
* @ORM\ManyToOne(targetEntity="SonataMediaMedia")
*/
private $media;
/**
* @ORM\ManyToMany(targetEntity=Domain::class, mappedBy="domainLangs")
*/
private $domains;
public function __construct()
{
$this->domains = new ArrayCollection();
$this->active = true;
}
public function __toString()
{
return $this->name;
}
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 getSlug(): ?string
{
return $this->slug;
}
public function setSlug(string $slug): self
{
$this->slug = $slug;
return $this;
}
public function getMain(): ?bool
{
return $this->main;
}
public function setMain(?bool $main): self
{
$this->main = $main;
return $this;
}
/**
* @return Collection|Menu[]
*/
public function getMenus(): Collection
{
return $this->menus;
}
public function addMenu(Menu $menu): self
{
if (!$this->menus->contains($menu)) {
$this->menus[] = $menu;
$menu->setDomainLang($this);
}
return $this;
}
public function removeMenu(Menu $menu): self
{
if ($this->menus->removeElement($menu)) {
// set the owning side to null (unless already changed)
if ($menu->getDomainLang() === $this) {
$menu->setDomainLang(null);
}
}
return $this;
}
/**
* @return Collection|Domain[]
*/
public function getDomains(): Collection
{
return $this->domains;
}
public function addDomain(Domain $domain): self
{
if (!$this->domains->contains($domain)) {
$this->domains[] = $domain;
$domain->addDomainLang($this);
}
return $this;
}
public function removeDomain(Domain $domain): self
{
if ($this->domains->removeElement($domain)) {
$domain->removeDomainLang($this);
}
return $this;
}
/**
* @return mixed
*/
public function getActive()
{
return $this->active;
}
/**
* @param mixed $active
*/
public function setActive($active)
{
$this->active = $active;
}
/**
* @return mixed
*/
public function getMedia()
{
return $this->media;
}
/**
* @param mixed $media
*/
public function setMedia($media)
{
$this->media = $media;
}
}