<?php
namespace App\CasinoBundle\Entity;
use App\CmsBundle\Entity\PublishedTrait;
use App\CmsBundle\Entity\SlugTrait;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="App\CasinoBundle\Repository\LanguageRepository")
* @ORM\Table(name="language",
* uniqueConstraints={
* @ORM\UniqueConstraint(name="language_alpha2_uindex", columns={"alpha2"}),
* @ORM\UniqueConstraint(name="language_name_uindex", columns={"name"}),
* @ORM\UniqueConstraint(name="language_slug_uindex", columns={"slug"})
* },
* indexes={
* @ORM\Index(name="language_published_index", columns={"published"})
* }
* )
*/
class Language
{
use SlugTrait;
use AliasTrait;
use PublishedTrait;
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer", options={"unsigned":true})
*/
private $id;
/**
* @var string
*
* @ORM\Column(type="string", length=45, unique=true, nullable=false)
*/
private $alpha2;
/**
* @var string
*
* @ORM\Column(type="string", length=45, unique=true, nullable=true)
*/
private $flagCountryAlpha2;
/**
* @var string
* @ORM\Column(type="string", length=90, name="name", nullable=false)
*/
private $name;
/**
* @ORM\ManyToMany(targetEntity="Country", mappedBy="languages")
*/
private $countries;
/**
* @ORM\ManyToMany(targetEntity="App\CasinoBundle\Entity\Casino", mappedBy="languages")
*/
private $casinos;
/**
* @ORM\ManyToMany(targetEntity="App\CasinoBundle\Entity\Casino", mappedBy="chatSupportLanguages")
*/
private $chatSupportCasinos;
/**
* @ORM\ManyToMany(targetEntity="App\CasinoBundle\Entity\Casino", mappedBy="emailSupportLanguages")
*/
private $emailSupportCasinos;
/**
* @ORM\ManyToMany(targetEntity="App\CasinoBundle\Entity\Casino", mappedBy="phoneSupportLanguages")
*/
private $phoneSupportCasinos;
/**
* @ORM\OneToMany(targetEntity="App\CasinoBundle\Entity\Url", mappedBy="language")
*/
private $urls;
/**
* @ORM\OneToMany(targetEntity="App\CasinoBundle\Entity\Alias", mappedBy="language", cascade={"persist"}, orphanRemoval=true)
*/
private Collection $aliases;
public function __construct()
{
$this->countries = new ArrayCollection();
$this->chatSupportCasinos = new ArrayCollection();
$this->phoneSupportCasinos = new ArrayCollection();
$this->emailSupportCasinos = new ArrayCollection();
$this->casinos = new ArrayCollection();
$this->urls = new ArrayCollection();
$this->aliases = new ArrayCollection();
}
/**
* @return string|null
*/
public function __toString()
{
return $this->getAlpha2();
}
/**
* @return mixed
*/
public function getId()
{
return $this->id;
}
/**
* @param mixed $id
*/
public function setId(mixed $id): void
{
$this->id = $id;
}
/**
* @return ?string
*/
public function getAlpha2(): ?string
{
return $this->alpha2;
}
/**
* @param string $alpha2
*/
public function setAlpha2(string $alpha2): void
{
$this->alpha2 = $alpha2;
}
/**
* @return string|null
*/
public function getFlagCountryAlpha2(): ?string
{
return $this->flagCountryAlpha2;
}
/**
* @param string|null $flagCountryAlpha2
*/
public function setFlagCountryAlpha2(?string $flagCountryAlpha2): void
{
$this->flagCountryAlpha2 = $flagCountryAlpha2;
}
/**
* @return ?string
*/
public function getName(): ?string
{
return $this->name;
}
/**
* @param string $name
*/
public function setName(string $name): void
{
$this->name = $name;
}
/**
* @return Collection
*/
public function getCountries(): Collection
{
return $this->countries;
}
/**
* @param Country $country
* @return $this
*/
public function addCountries(Country $country): self
{
if (!$this->countries->contains($country)) {
$this->countries[] = $country;
$country->addLanguage($this);
}
return $this;
}
/**
* @param Country $country
* @return $this
*/
public function removeCountries(Country $country): self
{
if ($this->countries->contains($country)) {
$this->countries->removeElement($country);
$country->removeLanguage($this);
}
return $this;
}
/**
* @return Collection
*/
public function getCasinos(): Collection
{
return $this->casinos;
}
/**
* @param Casino $casino
* @return $this
*/
public function addCasino(Casino $casino): self
{
if (!$this->casinos->contains($casino)) {
$this->casinos[] = $casino;
$casino->addLanguage($this);
}
return $this;
}
/**
* @param Casino $casino
* @return $this
*/
public function removeCasino(Casino $casino): self
{
if ($this->casinos->contains($casino)) {
$this->casinos->removeElement($casino);
$casino->removeLanguage($this);
}
return $this;
}
/**
* @return Collection
*/
public function getUrls(): Collection
{
return $this->urls;
}
/**
* @param Url $url
* @return $this
*/
public function addUrl(Url $url): self
{
if (!$this->urls->contains($url)) {
$this->urls[] = $url;
$url->setLanguage($this);
}
return $this;
}
/**
* @param Url $url
* @return $this
*/
public function removeUrl(Url $url): self
{
if ($this->urls->contains($url)) {
$this->urls->removeElement($url);
$url->setLanguage(null);
}
return $this;
}
}