<?php
namespace App\CmsBundle\Entity;
use App\CasinoBundle\Entity\BonusAmount;
use App\CasinoBundle\Entity\BonusCategory;
use App\CasinoBundle\Entity\Casino;
use App\CasinoBundle\Entity\CasinoCategory;
use App\CasinoBundle\Entity\City;
use App\CasinoBundle\Entity\Country;
use App\CasinoBundle\Entity\Currency;
use App\CasinoBundle\Entity\GameType;
use App\CasinoBundle\Entity\PaymentMethod;
use App\CasinoBundle\Entity\Slot;
use App\CasinoBundle\Entity\Software;
use App\CasinoBundle\Entity\State;
use App\CmsBundle\Enum\DirectoryType;
use App\CasinoBundle\Entity\MinDeposit;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(
* repositoryClass="App\CmsBundle\Repository\DirectoryItemRepository"
* )
* @ORM\Table(
* name="directory_item",
* indexes={
* @ORM\Index(name="directory_item_index", columns={"directory_id"})
* }
* )
*/
class DirectoryItem
{
use IdTrait;
/**
* @ORM\OneToOne(targetEntity="App\CmsBundle\Entity\Page", mappedBy="directoryItem")
* @ORM\JoinColumn(name="page_id", referencedColumnName="id", nullable=true, onDelete="CASCADE")
*/
private $page;
/**
* @ORM\ManyToOne(targetEntity="App\CmsBundle\Entity\Directory", inversedBy="directoryItems")
* @ORM\JoinColumn(nullable=true, onDelete="CASCADE")
*/
private $directory;
/**
* @ORM\ManyToOne(targetEntity="App\CasinoBundle\Entity\Casino")
* @ORM\JoinColumn(nullable=true)
*/
private $casino;
/**
* @ORM\ManyToOne(targetEntity="App\CasinoBundle\Entity\Slot")
* @ORM\JoinColumn(nullable=true, onDelete="CASCADE")
*/
private $slot;
/**
* @ORM\ManyToOne(targetEntity="App\CasinoBundle\Entity\Software", inversedBy="directoryItems")
* @ORM\JoinColumn(nullable=true)
*/
private $software;
/**
* @ORM\ManyToOne(targetEntity="App\CasinoBundle\Entity\PaymentMethod")
* @ORM\JoinColumn(nullable=true)
*/
private $paymentMethod;
/**
* @ORM\ManyToOne(targetEntity="App\CasinoBundle\Entity\Country")
* @ORM\JoinColumn(nullable=true)
*/
private $country;
/**
* @ORM\ManyToOne(targetEntity="App\CasinoBundle\Entity\Currency")
* @ORM\JoinColumn(nullable=true)
*/
private $currency;
/**
* @ORM\ManyToOne(targetEntity="App\CasinoBundle\Entity\GameType")
* @ORM\JoinColumn(nullable=true)
*/
private $gameType;
/**
* @ORM\ManyToOne(targetEntity="App\CasinoBundle\Entity\City")
* @ORM\JoinColumn(nullable=true)
*/
private $city;
/**
* @ORM\ManyToOne(targetEntity="App\CasinoBundle\Entity\State")
* @ORM\JoinColumn(nullable=true)
*/
private $state;
/**
* @ORM\ManyToOne(targetEntity="App\CasinoBundle\Entity\BonusAmount")
* @ORM\JoinColumn(nullable=true)
*/
private $bonusAmount;
/**
* @ORM\ManyToOne(targetEntity="App\CasinoBundle\Entity\MinDeposit")
* @ORM\JoinColumn(nullable=true)
*/
private $minDeposit;
/**
* @ORM\ManyToOne(targetEntity="App\CasinoBundle\Entity\BonusCategory")
* @ORM\JoinColumn(nullable=true)
*/
private $bonusCategory;
/**
* @ORM\ManyToOne(targetEntity="App\CasinoBundle\Entity\CasinoCategory")
* @ORM\JoinColumn(nullable=true)
*/
private $casinoCategory;
public function __construct()
{
}
/**
* @return Directory|null
*/
public function getDirectory(): ?Directory
{
return $this->directory;
}
/**
* @param Directory|null $directory
* @return $this
*/
public function setDirectory(?Directory $directory = null): self
{
$this->directory = $directory;
return $this;
}
/**
* @return Casino|null
*/
public function getCasino(): ?Casino
{
return $this->casino;
}
/**
* @param Casino|null $casino
* @return $this
*/
public function setCasino(?Casino $casino = null): self
{
$this->casino = $casino;
return $this;
}
/**
* @return Slot|null
*/
public function getSlot(): ?Slot
{
return $this->slot;
}
/**
* @param Slot|null $slot
* @return $this
*/
public function setSlot(?Slot $slot = null): self
{
$this->slot = $slot;
return $this;
}
/**
* @return Software|null
*/
public function getSoftware(): ?Software
{
return $this->software;
}
/**
* @param Software|null $software
* @return $this
*/
public function setSoftware(?Software $software = null): self
{
$this->software = $software;
return $this;
}
/**
* @return PaymentMethod|null
*/
public function getPaymentMethod(): ?PaymentMethod
{
return $this->paymentMethod;
}
/**
* @param PaymentMethod|null $paymentMethod
* @return $this
*/
public function setPaymentMethod(?PaymentMethod $paymentMethod = null): self
{
$this->paymentMethod = $paymentMethod;
return $this;
}
/**
* @return Country|null
*/
public function getCountry(): ?Country
{
return $this->country;
}
/**
* @param Country|null $country
* @return $this
*/
public function setCountry(?Country $country = null): self
{
$this->country = $country;
return $this;
}
/**
* @return Currency|null
*/
public function getCurrency(): ?Currency
{
return $this->currency;
}
/**
* @param Currency|null $currency
* @return $this
*/
public function setCurrency(?Currency $currency = null): self
{
$this->currency = $currency;
return $this;
}
/**
* @return GameType|null
*/
public function getGameType(): ?GameType
{
return $this->gameType;
}
/**
* @param GameType|null $gameType
* @return $this
*/
public function setGameType(?GameType $gameType = null): self
{
$this->gameType = $gameType;
return $this;
}
/**
* @return BonusAmount|null
*/
public function getBonusAmount(): ?BonusAmount
{
return $this->bonusAmount;
}
/**
* @param BonusAmount|null $bonusAmount
* @return $this
*/
public function setBonusAmount(?BonusAmount $bonusAmount = null): self
{
$this->bonusAmount = $bonusAmount;
return $this;
}
/**
* @return BonusCategory|null
*/
public function getBonusCategory(): ?BonusCategory
{
return $this->bonusCategory;
}
/**
* @param BonusCategory|null $bonusCategory
* @return $this
*/
public function setBonusCategory(?BonusCategory $bonusCategory = null): self
{
$this->bonusCategory = $bonusCategory;
return $this;
}
/**
* @return CasinoCategory|null
*/
public function getCasinoCategory(): ?CasinoCategory
{
return $this->casinoCategory;
}
/**
* @param CasinoCategory|null $casinoCategory
* @return $this
*/
public function setCasinoCategory(?CasinoCategory $casinoCategory = null): self
{
$this->casinoCategory = $casinoCategory;
return $this;
}
/**
* @return City|null
*/
public function getCity(): ?City
{
return $this->city;
}
/**
* @param City|null $city
* @return $this
*/
public function setCity(?City $city = null): self
{
$this->city = $city;
return $this;
}
/**
* @return State|null
*/
public function getState(): ?State
{
return $this->state;
}
/**
* @param State|null $state
* @return $this
*/
public function setState(?State $state = null): self
{
$this->state = $state;
return $this;
}
/**
* @return Page|null
*/
public function getPage(): ?Page
{
return $this->page;
}
/**
* @param Page|null $page
* @return $this
*/
public function setPage(?Page $page = null): self
{
$this->page = $page;
return $this;
}
/**
* @return MinDeposit|null
*/
public function getMinDeposit(): ?MinDeposit
{
return $this->minDeposit;
}
/**
* @param MinDeposit|null $minDeposit
* @return $this
*/
public function setMinDeposit(?MinDeposit $minDeposit = null): self
{
$this->minDeposit = $minDeposit;
return $this;
}
/**
* @return int|null
*/
public function getType(): ?int
{
if ($this->getCasino() != null) return DirectoryType::CASINO;
if ($this->getSlot() != null) return DirectoryType::SLOT;
if ($this->getSoftware() != null) return DirectoryType::SOFTWARE;
if ($this->getPaymentMethod() != null) return DirectoryType::PAYMENT_METHOD;
if ($this->getCountry() != null) return DirectoryType::COUNTRY;
if ($this->getGameType() != null) return DirectoryType::GAME_TYPE;
if ($this->getBonusAmount() != null) return DirectoryType::BONUS_AMOUNT;
if ($this->getState() != null) return DirectoryType::STATE;
if ($this->getCity() != null) return DirectoryType::CITY;
if ($this->getCurrency() != null) return DirectoryType::CURRENCY;
if ($this->getMinDeposit() != null) return DirectoryType::MIN_DEPOSIT;
return null;
}
/**
* @return string|null
*/
public function getSlug(): ?string
{
return match ($this->getType()) {
DirectoryType::CASINO => $this->getCasino()->getDomain(),
DirectoryType::SLOT => $this->getSlot()->getSlug(),
DirectoryType::SOFTWARE => $this->getSoftware()->getSlug(),
DirectoryType::PAYMENT_METHOD => $this->getPaymentMethod()->getSlug(),
DirectoryType::COUNTRY => $this->getCountry()->getSlug(),
DirectoryType::GAME_TYPE => $this->getGameType()->getSlug(),
DirectoryType::BONUS_AMOUNT => $this->getBonusAmount()->getSlug(),
DirectoryType::STATE => $this->getState()->getSlug(),
DirectoryType::CITY => $this->getCity()->getSlug(),
DirectoryType::CURRENCY => $this->getCurrency()->getSlug(),
DirectoryType::MIN_DEPOSIT => $this->getMinDeposit()->getSlug(),
default => null,
};
}
}