<?php
namespace App\CasinoBundle\Entity;
use App\CasinoBundle\Enum\IssueReportResolutionEnum;
use App\CasinoBundle\Enum\IssueReportIssueEnum;
use App\CasinoBundle\Enum\IssueReportTypeEnum;
use App\ProfileBundle\Entity\User;
use Doctrine\ORM\Mapping as ORM;
use App\CmsBundle\Entity\TimeStampedTrait;
use App\CmsBundle\Entity\IdTrait;
use App\CmsBundle\Entity\SiteTrait;
/**
* IssueReport
*
* @ORM\Table(
* name="issue_report",
* indexes={
* @ORM\Index(name="issue_report_created_index", columns={"created"}),
* @ORM\Index(name="issue_report_issue_index", columns={"issue"}),
* @ORM\Index(name="issue_report_resolution_index", columns={"resolution"}),
* @ORM\Index(name="issue_report_site_index", columns={"site_id"}),
* @ORM\Index(name="issue_report_user_index", columns={"user_id"}),
* @ORM\Index(name="issue_report_slot_index", columns={"slot_id"}),
* @ORM\Index(name="issue_report_bonus_index", columns={"bonus_id"}),
* @ORM\Index(name="issue_report_country_index", columns={"country_id"})
* }
* )
* @ORM\Entity(repositoryClass="App\CasinoBundle\Repository\IssueReportRepository")
* @ORM\HasLifecycleCallbacks()
*/
class IssueReport
{
use IdTrait, TimeStampedTrait, SiteTrait, UrlTrait, IpTrait;
/**
* @ORM\ManyToOne(targetEntity="App\ProfileBundle\Entity\User", inversedBy="issueReports")
* @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=true)
*/
private ?User $user;
/**
* @ORM\ManyToOne(targetEntity="App\CasinoBundle\Entity\Slot", inversedBy="issueReports")
* @ORM\JoinColumn(name="slot_id", referencedColumnName="id", nullable=true, onDelete="CASCADE")
*/
private ?Slot $slot;
/**
* @ORM\ManyToOne(targetEntity="App\CasinoBundle\Entity\NewBonus", inversedBy="issueReports")
* @ORM\JoinColumn(name="bonus_id", referencedColumnName="id", nullable=true)
*/
private ?NewBonus $newBonus;
/**
* @ORM\OneToOne(targetEntity="App\CasinoBundle\Entity\Country")
* @ORM\JoinColumn(name="country_id", referencedColumnName="id", nullable=true)
*/
private ?Country $country = null;
/**
* @var int
*
* @ORM\Column(name="issue", type="integer", nullable=false)
*/
private $issue;
/**
* @var int
*
* @ORM\Column(name="resolution", type="integer", nullable=false)
*/
private $resolution;
/**
* @var ?int
*
* @ORM\Column( name="type", type="integer", nullable=true)
*/
private $type;
/**
* @var ?string
*
* @ORM\Column(name="description", type="text", nullable=true)
*/
private $description;
/**
* @return User|null
*/
public function getUser(): ?User
{
return $this->user;
}
/**
* @param User|null $user
* @return $this
*/
public function setUser(?User $user): self
{
if ($user) {
$this->user = $user;
}
return $this;
}
/**
* @return User|null
*/
public function getNewBonus(): ?NewBonus
{
return $this->newBonus;
}
/**
* @param NewBonus|null $newBonus
* @return $this
*/
public function setNewBonus(?NewBonus $newBonus): self
{
if ($newBonus) {
$this->newBonus = $newBonus;
}
return $this;
}
/**
* @return Slot|null
*/
public function getSlot(): ?Slot
{
return $this->slot;
}
/**
* @param Slot|null $slot
* @return $this
*/
public function setSlot(?Slot $slot): self
{
if ($slot) {
$this->slot = $slot;
}
return $this;
}
/**
* @return ?Country
*/
public function getCountry(): ?Country
{
return $this->country;
}
/**
* @param ?Country $country
* @return $this
*/
public function setCountry(?Country $country): self
{
$this->country = $country;
return $this;
}
/**
* @return int
*/
public function getIssue(): int
{
return $this->issue;
}
/**
* @param int $issue
* @return $this
*/
public function setIssue(int $issue): self
{
IssueReportIssueEnum::assertExists($issue);
$this->issue = $issue;
return $this;
}
/**
* @return int
*/
public function getResolution(): int
{
return $this->resolution;
}
/**
* @param int $resolution
* @return $this
*/
public function setResolution(int $resolution): self
{
IssueReportResolutionEnum::assertExists($resolution);
$this->resolution = $resolution;
return $this;
}
/**
* @return ?int
*/
public function getType(): ?int
{
return $this->type;
}
/**
* @param ?int $type
* @return $this
*/
public function setType(?int $type): self
{
IssueReportTypeEnum::assertExists($type);
$this->type = $type;
return $this;
}
/**
* @return ?string
*/
public function getDescription(): ?string
{
return $this->description;
}
/**
* @param ?string $description
* @return $this
*/
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
/**
* Get the related entity ID (slot_id, new_bonus_id)
*
* @return int|null
*/
public function getEntityId(): ?int
{
switch ($this->type) {
case IssueReportTypeEnum::SLOT: {
return $this->slot?->getId();
}
case IssueReportTypeEnum::BONUS: {
return $this->newBonus?->getId();
}
default: {
return null;
}
}
}
}