src/CasinoBundle/Entity/IssueReport.php line 32

Open in your IDE?
  1. <?php
  2. namespace App\CasinoBundle\Entity;
  3. use App\CasinoBundle\Enum\IssueReportResolutionEnum;
  4. use App\CasinoBundle\Enum\IssueReportIssueEnum;
  5. use App\CasinoBundle\Enum\IssueReportTypeEnum;
  6. use App\ProfileBundle\Entity\User;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use App\CmsBundle\Entity\TimeStampedTrait;
  9. use App\CmsBundle\Entity\IdTrait;
  10. use App\CmsBundle\Entity\SiteTrait;
  11. /**
  12.  * IssueReport
  13.  *
  14.  * @ORM\Table(
  15.  *     name="issue_report",
  16.  *     indexes={
  17.  *         @ORM\Index(name="issue_report_created_index", columns={"created"}),
  18.  *         @ORM\Index(name="issue_report_issue_index", columns={"issue"}),
  19.  *         @ORM\Index(name="issue_report_resolution_index", columns={"resolution"}),
  20.  *         @ORM\Index(name="issue_report_site_index", columns={"site_id"}),
  21.  *         @ORM\Index(name="issue_report_user_index", columns={"user_id"}),
  22.  *         @ORM\Index(name="issue_report_slot_index", columns={"slot_id"}),
  23.  *         @ORM\Index(name="issue_report_bonus_index", columns={"bonus_id"}),
  24.  *         @ORM\Index(name="issue_report_country_index", columns={"country_id"})
  25.  *     }
  26.  * )
  27.  * @ORM\Entity(repositoryClass="App\CasinoBundle\Repository\IssueReportRepository")
  28.  * @ORM\HasLifecycleCallbacks()
  29.  */
  30. class IssueReport
  31. {
  32.     use IdTraitTimeStampedTraitSiteTraitUrlTraitIpTrait;
  33.     /**
  34.      * @ORM\ManyToOne(targetEntity="App\ProfileBundle\Entity\User", inversedBy="issueReports")
  35.      * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=true)
  36.      */
  37.     private ?User $user;
  38.     /**
  39.      * @ORM\ManyToOne(targetEntity="App\CasinoBundle\Entity\Slot", inversedBy="issueReports")
  40.      * @ORM\JoinColumn(name="slot_id", referencedColumnName="id", nullable=true, onDelete="CASCADE")
  41.      */
  42.     private ?Slot $slot;
  43.     /**
  44.      * @ORM\ManyToOne(targetEntity="App\CasinoBundle\Entity\NewBonus", inversedBy="issueReports")
  45.      * @ORM\JoinColumn(name="bonus_id", referencedColumnName="id", nullable=true)
  46.      */
  47.     private ?NewBonus $newBonus;
  48.     /**
  49.      * @ORM\OneToOne(targetEntity="App\CasinoBundle\Entity\Country")
  50.      * @ORM\JoinColumn(name="country_id", referencedColumnName="id", nullable=true)
  51.      */
  52.     private ?Country $country null;
  53.     /**
  54.      * @var int
  55.      *
  56.      * @ORM\Column(name="issue", type="integer", nullable=false)
  57.      */
  58.     private $issue;
  59.     /**
  60.      * @var int
  61.      *
  62.      * @ORM\Column(name="resolution", type="integer", nullable=false)
  63.      */
  64.     private $resolution;
  65.     /**
  66.      * @var ?int
  67.      *
  68.      * @ORM\Column( name="type", type="integer", nullable=true)
  69.      */
  70.     private $type;
  71.     /**
  72.      * @var ?string
  73.      *
  74.      * @ORM\Column(name="description", type="text", nullable=true)
  75.      */
  76.     private $description;
  77.     /**
  78.      * @return User|null
  79.      */
  80.     public function getUser(): ?User
  81.     {
  82.         return $this->user;
  83.     }
  84.     /**
  85.      * @param User|null $user
  86.      * @return $this
  87.      */
  88.     public function setUser(?User $user): self
  89.     {
  90.         if ($user) {
  91.             $this->user $user;
  92.         }
  93.         return $this;
  94.     }
  95.     /**
  96.      * @return User|null
  97.      */
  98.     public function getNewBonus(): ?NewBonus
  99.     {
  100.         return $this->newBonus;
  101.     }
  102.     /**
  103.      * @param NewBonus|null $newBonus
  104.      * @return $this
  105.      */
  106.     public function setNewBonus(?NewBonus $newBonus): self
  107.     {
  108.         if ($newBonus) {
  109.             $this->newBonus $newBonus;
  110.         }
  111.         return $this;
  112.     }
  113.     /**
  114.      * @return Slot|null
  115.      */
  116.     public function getSlot(): ?Slot
  117.     {
  118.         return $this->slot;
  119.     }
  120.     /**
  121.      * @param Slot|null $slot
  122.      * @return $this
  123.      */
  124.     public function setSlot(?Slot $slot): self
  125.     {
  126.         if ($slot) {
  127.             $this->slot $slot;
  128.         }
  129.         return $this;
  130.     }
  131.     /**
  132.      * @return ?Country
  133.      */
  134.     public function getCountry(): ?Country
  135.     {
  136.         return $this->country;
  137.     }
  138.     /**
  139.      * @param ?Country $country
  140.      * @return $this
  141.      */
  142.     public function setCountry(?Country $country): self
  143.     {
  144.         $this->country $country;
  145.         return $this;
  146.     }
  147.     /**
  148.      * @return int
  149.      */
  150.     public function getIssue(): int
  151.     {
  152.         return $this->issue;
  153.     }
  154.     /**
  155.      * @param int $issue
  156.      * @return $this
  157.      */
  158.     public function setIssue(int $issue): self
  159.     {
  160.         IssueReportIssueEnum::assertExists($issue);
  161.         $this->issue $issue;
  162.         return $this;
  163.     }
  164.     /**
  165.      * @return int
  166.      */
  167.     public function getResolution(): int
  168.     {
  169.         return $this->resolution;
  170.     }
  171.     /**
  172.      * @param int $resolution
  173.      * @return $this
  174.      */
  175.     public function setResolution(int $resolution): self
  176.     {
  177.         IssueReportResolutionEnum::assertExists($resolution);
  178.         $this->resolution $resolution;
  179.         return $this;
  180.     }
  181.     /**
  182.      * @return ?int
  183.      */
  184.     public function getType(): ?int
  185.     {
  186.         return $this->type;
  187.     }
  188.     /**
  189.      * @param ?int $type
  190.      * @return $this
  191.      */
  192.     public function setType(?int $type): self
  193.     {
  194.         IssueReportTypeEnum::assertExists($type);
  195.         $this->type $type;
  196.         return $this;
  197.     }
  198.     /**
  199.      * @return ?string
  200.      */
  201.     public function getDescription(): ?string
  202.     {
  203.         return $this->description;
  204.     }
  205.     /**
  206.      * @param ?string $description
  207.      * @return $this
  208.      */
  209.     public function setDescription(?string $description): self
  210.     {
  211.         $this->description $description;
  212.         return $this;
  213.     }
  214.     /**
  215.      * Get the related entity ID (slot_id, new_bonus_id)
  216.      *
  217.      * @return int|null
  218.      */
  219.     public function getEntityId(): ?int
  220.     {
  221.         switch ($this->type) {
  222.             case IssueReportTypeEnum::SLOT: {
  223.                 return $this->slot?->getId();
  224.             }
  225.             case IssueReportTypeEnum::BONUS: {
  226.                 return $this->newBonus?->getId();
  227.             }
  228.             default: {
  229.                 return null;
  230.             }
  231.         }
  232.     }
  233. }