<?php
namespace App\CasinoBundle\Entity;
use App\CmsBundle\Entity\PublishedTrait;
use App\CmsBundle\Entity\SlugTrait;
use App\CmsBundle\Entity\TimeStampedTrait;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use App\CmsBundle\Entity\IdTrait;
/**
* Currency
*
* @ORM\Table(
* name="currency",
* uniqueConstraints={
* @ORM\UniqueConstraint(name="currency_alphabetic_code_uindex", columns={"alphabetic_code"}),
* @ORM\UniqueConstraint(name="currency_slug_uindex", columns={"slug"})
* },
* indexes={
* @ORM\Index(name="currency_published_index", columns={"published"})
* }
* )
* @ORM\Entity(repositoryClass="App\CasinoBundle\Repository\CurrencyRepository")
* @ORM\Cache(usage="NONSTRICT_READ_WRITE", region="one_day")
* @ORM\HasLifecycleCallbacks()
*/
class Currency
{
use IdTrait;
use NameTrait;
use SlugTrait;
use AliasTrait;
use SignTrait;
use PublishedTrait;
use TimeStampedTrait;
/**
* @var string|null
*
* @ORM\Column(name="alphabetic_code", type="string", length=255, nullable=true)
*/
private $alphabeticCode;
/**
* @var int|null
*
* @ORM\Column(name="numeric_code", type="integer", nullable=true)
*/
private $numericCode;
/**
* @var int|null
*
* @ORM\Column(name="sign_position", type="integer", nullable=true)
*/
private ?int $signPosition;
/**
* @ORM\ManyToMany(targetEntity="Country", mappedBy="currencies", cascade={"persist"})
*/
private $countries;
/**
* @ORM\ManyToMany(targetEntity="App\CasinoBundle\Entity\Casino", mappedBy="currencies", cascade={"persist"})
*/
private $casinos;
/**
* @ORM\ManyToMany(targetEntity="App\CasinoBundle\Entity\NewBonus", mappedBy="currencies", cascade={"persist"})
*/
private $newBonuses;
/**
* @ORM\OneToMany(targetEntity="App\CasinoBundle\Entity\Alias", mappedBy="currency", cascade={"persist"}, orphanRemoval=true)
*/
private Collection $aliases;
/**
* Currency constructor.
*/
public function __construct()
{
$this->countries = new ArrayCollection();
$this->casinos = new ArrayCollection();
$this->aliases = new ArrayCollection();
$this->newBonuses = new ArrayCollection();
}
/**
* @return string|null
*/
public function __toString()
{
return $this->getAlphabeticCode();
}
/**
* @return null|string
*/
public function getAlphabeticCode(): ?string
{
return $this->alphabeticCode;
}
/**
* @param null|string $alphabeticCode
*/
public function setAlphabeticCode(?string $alphabeticCode): self
{
$this->alphabeticCode = $alphabeticCode;
return $this;
}
/**
* @return int|null
*/
public function getNumericCode(): ?int
{
return $this->numericCode;
}
/**
* @param int|null $numericCode
*/
public function setNumericCode(?int $numericCode): self
{
$this->numericCode = $numericCode;
return $this;
}
/**
* @return Collection|Country[]
*/
public function getCountries(): Collection
{
return $this->countries;
}
/**
* @param Country $country
* @return $this
*/
public function addCountry(Country $country): self
{
if (!$this->countries->contains($country)) {
$this->countries[] = $country;
$country->addCurrency($this);
}
return $this;
}
/**
* @param Country $country
* @return $this
*/
public function removeCountry(Country $country): self
{
if ($this->countries->contains($country)) {
$this->countries->removeElement($country);
$country->removeCurrency($this);
}
return $this;
}
/**
* @return Collection|Casino[]
*/
public function getCasinos(): Collection
{
return $this->casinos;
}
public function addCasino(Casino $casino): self
{
if (!$this->casinos->contains($casino)) {
$this->casinos[] = $casino;
$casino->addCurrency($this);
}
return $this;
}
public function removeCasino(Casino $casino): self
{
if ($this->casinos->contains($casino)) {
$this->casinos->removeElement($casino);
$casino->removeCurrency($this);
}
return $this;
}
/**
* @return Collection|NewBonus[]
*/
public function getNewBonuses(): Collection
{
return $this->newBonuses;
}
/**
* @param NewBonus $newBonus
* @return $this
*/
public function addNewBonus(NewBonus $newBonus): self
{
if (!$this->newBonuses->contains($newBonus)) {
$this->newBonuses[] = $newBonus;
$newBonus->addCurrency($this);
}
return $this;
}
/**
* @param NewBonus $newBonus
* @return $this
*/
public function removeNewBonus(NewBonus $newBonus): self
{
if ($this->newBonuses->contains($newBonus)) {
$this->newBonuses->removeElement($newBonus);
$newBonus->removeCurrency($this);
}
return $this;
}
/**
* @return int|null
*/
public function getSignPosition(): ?int
{
return $this->signPosition;
}
/**
* @param int|null $signPosition
* @return $this
*/
public function setSignPosition(?int $signPosition): self
{
$this->signPosition = $signPosition;
return $this;
}
}