<?php
namespace App\CasinoBundle\Entity;
use App\CmsBundle\Entity\LogInterface;
use App\CmsBundle\Entity\LogTrait;
use App\CmsBundle\Entity\PublishedTrait;
use App\CmsBundle\Entity\Site;
use App\CmsBundle\Entity\SlugTrait;
use App\CmsBundle\Entity\IdTrait;
use App\CmsBundle\Enum\LogActionEnum;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use App\CmsBundle\Entity\TimeStampedTrait;
use DateTime;
/**
* Slot
*
* @ORM\Table(
* name="slot",
* indexes={
* @ORM\Index(name="slot_published_index", columns={"published"}),
* @ORM\Index(name="slot_layout_index", columns={"layout"}),
* @ORM\Index(name="slot_enable_game_index", columns={"enable_game"})
* },
* uniqueConstraints={
* @ORM\UniqueConstraint(name="slot_slug_uindex", columns={"slug"})
* }
* )
* @ORM\Entity(
* repositoryClass="App\CasinoBundle\Repository\SlotRepository"
* )
* @ORM\HasLifecycleCallbacks()
* @ORM\Cache(
* usage="NONSTRICT_READ_WRITE",
* region="one_day"
* )
*/
class Slot implements LogInterface
{
use IdTrait, NameTrait, TimeStampedTrait, AliasTrait, SlugTrait, AliasTrait, SlotcatalogIdTrait, PublishedTrait, LogTrait;
/**
* @ORM\Column(
* type="text",
* nullable=true
* )
*/
private $info;
/**
* @var Software|null
* @ORM\ManyToOne(
* targetEntity="Software",
* inversedBy="slots"
* )
* @ORM\JoinColumn(
* name="software_id",
* referencedColumnName="id",
* nullable=true
* )
*/
private $software;
/**
* @var GameType|null
* @ORM\ManyToOne(
* targetEntity="GameType",
* inversedBy="slots"
* )
* @ORM\JoinColumn(
* name="game_type_id",
* referencedColumnName="id",
* nullable=true
* )
*/
private $gameType;
/**
* @ORM\Column(
* type="float",
* nullable=true
* )
*/
private $rtp;
/**
* @ORM\OneToMany(
* targetEntity="App\CasinoBundle\Entity\SlotScreenshot",
* mappedBy="slot",
* cascade={"persist"},
* orphanRemoval=true
* )
* @ORM\OrderBy(
* {"position" = "ASC"}
* )
*/
private $slotScreenshots;
/**
* @ORM\OneToMany(
* targetEntity="App\CasinoBundle\Entity\SlotCasinoGeo",
* mappedBy="slot",
* cascade={"persist"},
* orphanRemoval=true
* )
*/
private $slotCasinosGeos;
/**
* @ORM\ManyToMany(
* targetEntity="SlotTag",
* inversedBy="slots",
* cascade={"persist"}
* )
*/
private $slotTags;
/**
* @ORM\ManyToMany(
* targetEntity="SlotFeature",
* inversedBy="slots",
* cascade={"persist"}
* )
*/
private $slotFeatures;
/**
* @ORM\ManyToMany(
* targetEntity="SlotTheme",
* fetch="EXTRA_LAZY",
* inversedBy="slots",
* cascade={"persist"}
* )
*/
private $slotThemes;
/**
* @ORM\ManyToMany(
* targetEntity="SlotDevice",
* inversedBy="slots",
* cascade={"persist"}
* )
*/
private $slotDevices;
/**
* @var DateTime
*
* @ORM\Column(
* type="datetime",
* nullable=true)
*/
private $release;
/**
* @ORM\Column(
* name="min_bet",
* type="float",
* nullable=true
* )
*/
private $minBet;
/**
* @ORM\Column(
* name="max_bet",
* type="float",
* nullable=true
* )
*/
private $maxBet;
/**
* @ORM\Column(
* type="integer",
* nullable=true
* )
*/
private $type;
/**
* @ORM\Column(
* type="string",
* length=255,
* nullable=true
* )
*/
private $videoUrl;
/**
* @ORM\Column(
* type="integer",
* nullable=true
* )
*/
private $rank;
/**
* @ORM\Column(
* type="integer",
* nullable=true
* )
*/
private $paylines;
/**
* @ORM\Column(
* type="string",
* length=255,
* nullable=true
* )
*/
private $layout;
/**
* @ORM\Column(
* type="string",
* length=255,
* nullable=true
* )
*/
private $technology;
/**
* @ORM\Column(
* type="string",
* length=255,
* nullable=true
* )
*/
private $variance;
/**
* @ORM\Column(
* type="integer",
* nullable=true
* )
*/
private $maxWin;
/**
* @ORM\Column(
* type="text",
* nullable=true
* )
*/
private $source;
/**
* @ORM\Column(
* type="string",
* length=255,
* nullable=true
* )
*/
private $galleryHash;
/**
* @ORM\Column(
* type="string",
* length=255,
* nullable=true
* )
*/
private $dataHash;
/**
* @ORM\Column(
* type="boolean",
* nullable=false,
* options={"default" = false}
* )
*/
private $enableGame = false;
/**
* @ORM\OneToMany(
* targetEntity="App\CasinoBundle\Entity\Alias",
* mappedBy="slot",
* cascade={"persist"},
* orphanRemoval=true
* )
*/
private Collection $aliases;
/**
* @ORM\Column(
* type="text",
* nullable=true
* )
*/
private $countries;
/**
* @ORM\ManyToMany(
* targetEntity="App\CasinoBundle\Entity\Casino",
* mappedBy="slots"
* )
*/
private $casinos;
/**
* @ORM\ManyToMany(
* targetEntity="App\CmsBundle\Entity\Site",
* fetch="EXTRA_LAZY",
* cascade={"persist"}
* )
* @ORM\JoinTable(
* name="slot_site",
* joinColumns={
* @ORM\JoinColumn(name="slot_id", referencedColumnName="id")
* },
* inverseJoinColumns={
* @ORM\JoinColumn(name="site_id", referencedColumnName="id")
* }
* )
*/
protected Collection $sites;
/**
* @ORM\ManyToMany(
* targetEntity="App\CasinoBundle\Entity\NewBonus",
* mappedBy="slots",
* cascade={"persist"}
* )
*/
private Collection $newBonuses;
/**
* @ORM\OneToMany(
* targetEntity="App\CasinoBundle\Entity\IssueReport",
* mappedBy="slot",
* )
*/
private Collection $issueReports;
public function __construct()
{
$this->slotTags = new ArrayCollection();
$this->slotScreenshots = new ArrayCollection();
$this->slotCasinosGeos = new ArrayCollection();
$this->slotThemes = new ArrayCollection();
$this->slotFeatures = new ArrayCollection();
$this->slotDevices = new ArrayCollection();
$this->aliases = new ArrayCollection();
$this->sites = new ArrayCollection();
$this->casinos = new ArrayCollection();
$this->newBonuses = new ArrayCollection();
$this->issueReports = new ArrayCollection();
}
public function __toString(): string
{
return $this->name;
}
public function getCountries(): ?string
{
return $this->countries;
}
public function setCountries(?string $countries = null): self
{
$this->countries = $countries;
return $this;
}
public function getNameWithSoftware(): ?string
{
$software = ($this->software)
? ' - ' . $this->software->getName()
: '';
return $this->getName() . $software;
}
public function getNameWithSlugAndSoftware(): ?string
{
$software = ($this->software)
? ' - ' . $this->software->getName()
: '';
return $this->getName() . ' (' . $this->getSlug() . ') ' . $software;
}
public function getSoftware(): ?Software
{
return $this->software;
}
public function setSoftware(?Software $software): self
{
$this->software = $software;
return $this;
}
public function getGameType(): ?GameType
{
return $this->gameType;
}
public function setGameType(?GameType $gameType): self
{
$this->gameType = $gameType;
if ($gameType) {
$gameType->addSlot($this);
} else {
$gameType->removeSlot($this);
}
return $this;
}
public function getRtp(): ?float
{
return $this->rtp;
}
public function setRtp($rtp): self
{
$this->rtp = ($rtp) ? floatval($rtp) : null;
return $this;
}
public function getInfo(): ?string
{
return $this->info;
}
public function setInfo(?string $info): self
{
$this->info = $info;
return $this;
}
public function getRelease(): ?DateTime
{
return $this->release;
}
public function setRelease(?DateTime $release): self
{
$this->release = $release;
return $this;
}
public function getMinBet(): ?float
{
return $this->minBet;
}
public function setMinBet(?float $minBet): self
{
$this->minBet = $minBet;
return $this;
}
public function getMaxBet(): ?float
{
return $this->maxBet;
}
public function setMaxBet(?float $maxBet): self
{
$this->maxBet = $maxBet;
return $this;
}
public function setType(?int $type): self
{
$this->type = $type;
return $this;
}
public function getType(): ?int
{
return $this->type;
}
public function getVideoUrl(): ?string
{
return $this->videoUrl;
}
public function setVideoUrl(?string $videoUrl): self
{
$this->videoUrl = $videoUrl;
return $this;
}
public function getRank(): ?int
{
return $this->rank;
}
public function setRank(?int $rank): self
{
$this->rank = $rank;
return $this;
}
public function getPaylines(): ?int
{
return $this->paylines;
}
public function setPaylines(?int $paylines): self
{
$this->paylines = $paylines;
return $this;
}
public function getLayout(): ?string
{
return $this->layout;
}
public function setLayout(?string $layout): self
{
$this->layout = $layout;
return $this;
}
public function getGalleryHash(): ?string
{
return $this->galleryHash;
}
public function setGalleryHash(?string $hash): self
{
$this->galleryHash = $hash;
return $this;
}
public function getDataHash(): ?string
{
return $this->dataHash;
}
public function setDataHash(?string $hash): self
{
$this->dataHash = $hash;
return $this;
}
public function getTechnology(): ?string
{
return $this->technology;
}
public function setTechnology(?string $technology): self
{
$this->technology = $technology;
return $this;
}
public function getVariance(): ?string
{
return $this->variance;
}
public function setVariance(?string $variance): self
{
$this->variance = $variance;
return $this;
}
public function getMaxWin(): ?int
{
return $this->maxWin;
}
public function setMaxWin(?int $maxWin): self
{
$this->maxWin = $maxWin;
return $this;
}
public function getSource(): ?string
{
return $this->source;
}
public function setSource(?string $source): self
{
$this->source = $source;
return $this;
}
/**
* @return Collection|SlotScreenshot[]
*/
public function getScreenshots()
{
return $this->slotScreenshots;
}
public function addScreenshot(SlotScreenshot $screenshot): self
{
if (!$this->slotScreenshots->contains($screenshot)) {
$this->slotScreenshots[] = $screenshot;
$screenshot->setSlot($this);
$this->addCollectionLog(LogActionEnum::ADD, 'screenshot', $screenshot);
}
return $this;
}
public function removeScreenshot(SlotScreenshot $screenshot): self
{
if ($this->slotScreenshots->contains($screenshot)) {
$this->slotScreenshots->removeElement($screenshot);
$screenshot->setSlot(null);
$this->addCollectionLog(LogActionEnum::REMOVE, 'screenshot', $screenshot);
}
return $this;
}
/**
* @return Collection|SlotCasinoGeo[]
*/
public function getSlotCasinosGeos()
{
return $this->slotCasinosGeos;
}
public function addSlotCasinosGeos(SlotCasinoGeo $slotCasinoGeo): self
{
if (!$this->slotCasinosGeos->contains($slotCasinoGeo)) {
$this->slotCasinosGeos[] = $slotCasinoGeo;
$slotCasinoGeo->setSlot($this);
$this->addCollectionLog(LogActionEnum::ADD, 'slotCasinoGeo', $slotCasinoGeo);
}
return $this;
}
public function removeSlotCasinosGeos(SlotCasinoGeo $slotCasinoGeo): self
{
if ($this->slotCasinosGeos->contains($slotCasinoGeo)) {
$this->slotCasinosGeos->removeElement($slotCasinoGeo);
$slotCasinoGeo->setSlot(null);
$this->addCollectionLog(LogActionEnum::REMOVE, 'slotCasinoGeo', $slotCasinoGeo);
}
return $this;
}
public function getSlotDevices()
{
return $this->slotDevices;
}
public function addSlotDevice(SlotDevice $device): self
{
if (!$this->slotDevices->contains($device)) {
$this->slotDevices[] = $device;
$device->addSlot($this);
$this->addCollectionLog(LogActionEnum::ADD, 'slotDevice', $device);
}
return $this;
}
public function removeSlotDevice(SlotDevice $device): self
{
if ($this->slotDevices->contains($device)) {
$this->slotDevices->removeElement($device);
$device->removeSlot($this);
$this->addCollectionLog(LogActionEnum::REMOVE, 'slotDevice', $device);
}
return $this;
}
public function getSlotTags()
{
return $this->slotTags;
}
public function addSlotTag(SlotTag $tag): self
{
if (!$this->slotTags->contains($tag)) {
$this->slotTags[] = $tag;
$tag->addSlot($this);
$this->addCollectionLog(LogActionEnum::ADD, 'slotTag', $tag);
}
return $this;
}
public function removeSlotTag(SlotTag $tag): self
{
if ($this->slotTags->contains($tag)) {
$this->slotTags->removeElement($tag);
$tag->removeSlot($this);
$this->addCollectionLog(LogActionEnum::REMOVE, 'slotTag', $tag);
}
return $this;
}
public function getSlotFeatures()
{
return $this->slotFeatures;
}
public function addSlotFeature(SlotFeature $slotFeature): self
{
if (!$this->slotFeatures->contains($slotFeature)) {
$this->slotFeatures[] = $slotFeature;
$slotFeature->addSlot($this);
$this->addCollectionLog(LogActionEnum::ADD, 'slotFeature', $slotFeature);
}
return $this;
}
public function removeSlotFeature(SlotFeature $slotFeature): self
{
if ($this->slotFeatures->contains($slotFeature)) {
$this->slotFeatures->removeElement($slotFeature);
$slotFeature->removeSlot($this);
$this->addCollectionLog(LogActionEnum::REMOVE, 'slotFeature', $slotFeature);
}
return $this;
}
public function getSlotThemes()
{
return $this->slotThemes;
}
public function addSlotTheme(SlotTheme $slotTheme): self
{
if (!$this->slotThemes->contains($slotTheme)) {
$this->slotThemes[] = $slotTheme;
$slotTheme->addSlot($this);
$this->addCollectionLog(LogActionEnum::ADD, 'slotTheme', $slotTheme);
}
return $this;
}
public function removeSlotTheme(SlotTheme $slotTheme): self
{
if ($this->slotThemes->contains($slotTheme)) {
$this->slotThemes->removeElement($slotTheme);
$slotTheme->removeSlot($this);
$this->addCollectionLog(LogActionEnum::REMOVE, 'slotTheme', $slotTheme);
}
return $this;
}
public function setEnableGame(bool $enableGame): self
{
$this->enableGame = $enableGame;
return $this;
}
public function getEnableGame(): bool
{
return $this->enableGame;
}
/**
* @return Collection|Casino[]
*/
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->addSlot($this);
$this->addCollectionLog(LogActionEnum::ADD, 'casino', $casino);
}
return $this;
}
/**
* @param Casino $casino
* @return $this
*/
public function removeCasino(Casino $casino): self
{
if ($this->casinos->contains($casino)) {
$this->casinos->removeElement($casino);
$casino->removeSlot($this);
$this->addCollectionLog(LogActionEnum::REMOVE, 'casino', $casino);
}
return $this;
}
/**
* @return Collection|Site[]
*/
public function getSites(): Collection
{
return $this->sites;
}
/**
* @param Site $site
* @return $this
*/
public function addSite(Site $site): self
{
if (!$this->sites->contains($site)) {
$this->sites[] = $site;
$this->addCollectionLog(LogActionEnum::ADD, 'site', $site);
}
return $this;
}
/**
* @param Site $site
* @return $this
*/
public function removeSite(Site $site): self
{
if ($this->sites->contains($site)) {
$this->sites->removeElement($site);
$this->addCollectionLog(LogActionEnum::REMOVE, 'site', $site);
}
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->addSlot($this);
$this->addCollectionLog(LogActionEnum::ADD, 'newBonus', $newBonus);
}
return $this;
}
/**
* @param NewBonus $newBonus
* @return $this
*/
public function removeNewBonus(NewBonus $newBonus): self
{
if ($this->newBonuses->contains($newBonus)) {
$this->newBonuses->removeElement($newBonus);
$newBonus->removeSlot($this);
$this->addCollectionLog(LogActionEnum::REMOVE, 'newBonus', $newBonus);
}
return $this;
}
/**
* @return Collection|IssueReport[]
*/
public function getIssueReports(): Collection
{
return $this->issueReports;
}
/**
* @param IssueReport $issueReport
* @return $this
*/
public function addIssueReport(IssueReport $issueReport): self
{
if (!$this->issueReports->contains($issueReport)) {
$this->issueReports[] = $issueReport;
$issueReport->setSlot($this);
$this->addCollectionLog(LogActionEnum::ADD, 'issueReport', $issueReport);
}
return $this;
}
/**
* @param IssueReport $issueReport
* @return $this
*/
public function removeIssueReport(IssueReport $issueReport): self
{
if ($this->issueReports->contains($issueReport)) {
$this->issueReports->removeElement($issueReport);
$issueReport->setSlot(null);
$this->addCollectionLog(LogActionEnum::REMOVE, 'issueReport', $issueReport);
}
return $this;
}
}