src/CasinoBundle/Entity/NewBonus.php line 55

Open in your IDE?
  1. <?php
  2. namespace App\CasinoBundle\Entity;
  3. use App\CasinoBundle\Enum\BonusOfferTypeEnum;
  4. use App\CmsBundle\Entity\LogInterface;
  5. use App\CmsBundle\Entity\LogTrait;
  6. use App\CmsBundle\Entity\PublishedTrait;
  7. use App\CmsBundle\Entity\Site;
  8. use App\CmsBundle\Enum\LogActionEnum;
  9. use Doctrine\Common\Collections\ArrayCollection;
  10. use Doctrine\Common\Collections\Collection;
  11. use Doctrine\ORM\Mapping as ORM;
  12. use App\CmsBundle\Entity\TimeStampedTrait;
  13. use DateTime;
  14. use App\CmsBundle\Entity\IdTrait;
  15. use App\CmsBundle\Entity\TitleTrait;
  16. /**
  17.  * NewBonus
  18.  *
  19.  * @ORM\Table(
  20.  *     name="new_bonus",
  21.  *     indexes={
  22.  *          @ORM\Index(name="new_bonus_title_short_index", columns={"title_short"}),
  23.  *          @ORM\Index(name="new_bonus_title_index", columns={"title"}),
  24.  *          @ORM\Index(name="new_bonus_updated_index", columns={"updated"}),
  25.  *          @ORM\Index(name="new_bonus_amount_max_index", columns={"amount_max"}),
  26.  *          @ORM\Index(name="new_bonus_free_spins_index", columns={"free_spins"}),
  27.  *          @ORM\Index(name="new_bonus_percent_index", columns={"percent"}),
  28.  *          @ORM\Index(name="new_bonus_deposit_min_index", columns={"deposit_min"}),
  29.  *          @ORM\Index(name="new_bonus_code_index", columns={"code"}),
  30.  *          @ORM\Index(name="new_bonus_skin_bg_index", columns={"skin_bg"}),
  31.  *          @ORM\Index(name="new_bonus_skin_character_index", columns={"skin_character"}),
  32.  *          @ORM\Index(name="new_bonus_published_index", columns={"published"}),
  33.  *          @ORM\Index(name="new_bonus_clone_index", columns={"clone"}),
  34.  *          @ORM\Index(name="new_bonus_score_index", columns={"score"}),
  35.  *          @ORM\Index(name="new_bonus_expired_index", columns={"expired_date"}),
  36.  *          @ORM\Index(name="new_bonus_start_published_date_index", columns={"start_published_date"}),
  37.  *          @ORM\Index(name="new_bonus_end_published_date_index", columns={"end_published_date"})
  38.  *     },
  39.  *     uniqueConstraints={
  40.  *         @ORM\UniqueConstraint(name="new_bonus_hash_uindex", columns={"hash"})
  41.  *     }
  42.  * )
  43.  * @ORM\Entity(
  44.  *     repositoryClass="App\CasinoBundle\Repository\NewBonusRepository"
  45.  * )
  46.  * @ORM\HasLifecycleCallbacks()
  47.  * @ORM\Cache(
  48.  *     usage="NONSTRICT_READ_WRITE",
  49.  *     region="one_day"
  50.  * )
  51.  */
  52. class NewBonus implements LogInterface
  53. {
  54.     use IdTraitTitleTraitTimeStampedTraitScoreTraitAliasTraitHashTraitCacheTraitPublishedTraitLogTrait;
  55.     /**
  56.      * @var string
  57.      *
  58.      * @ORM\Column(
  59.      *     name="title_short",
  60.      *     type="string",
  61.      *     length=255,
  62.      *     nullable=true
  63.      *     )
  64.      */
  65.     private $titleShort;
  66.     /**
  67.      * @ORM\ManyToOne(
  68.      *     targetEntity="App\CasinoBundle\Entity\Casino",
  69.      *     inversedBy="newBonuses",
  70.      *     cascade={"persist"}
  71.      * )
  72.      * @ORM\JoinColumn(
  73.      *     nullable=false
  74.      * )
  75.      */
  76.     private ?Casino $casino;
  77.     /**
  78.      * @ORM\ManyToMany (
  79.      *     targetEntity="App\CasinoBundle\Entity\BonusCategory",
  80.      *     inversedBy="newBonuses",
  81.      *     cascade={"persist"},
  82.      *     fetch="EXTRA_LAZY"
  83.      * )
  84.      * @ORM\JoinTable(
  85.      *     name="new_bonus_bonus_categories",
  86.      *     joinColumns={
  87.      *          @ORM\JoinColumn(name="new_bonus_id", referencedColumnName="id")
  88.      *     },
  89.      *     inverseJoinColumns={
  90.      *          @ORM\JoinColumn(name="bonus_category_id", referencedColumnName="id")
  91.      *     }
  92.      * )
  93.      */
  94.     private Collection $bonusCategories;
  95.     /**
  96.      * @ORM\ManyToMany (
  97.      *     targetEntity="App\CasinoBundle\Entity\BonusType",
  98.      *     inversedBy="newBonuses",
  99.      *     cascade={"persist"},
  100.      *     fetch="EXTRA_LAZY"
  101.      * )
  102.      * @ORM\JoinTable(
  103.      *     name="new_bonus_bonus_type",
  104.      *     joinColumns={
  105.      *          @ORM\JoinColumn(name="new_bonus_id", referencedColumnName="id")
  106.      *     },
  107.      *     inverseJoinColumns={
  108.      *          @ORM\JoinColumn(name="bonus_type_id", referencedColumnName="id")
  109.      *     }
  110.      * )
  111.      */
  112.     private Collection $bonusTypes;
  113.     /**
  114.      * @ORM\ManyToMany (
  115.      *     targetEntity="App\CasinoBundle\Entity\Currency",
  116.      *     inversedBy="newBonuses",
  117.      *     cascade={"persist"},
  118.      *     fetch="EXTRA_LAZY"
  119.      *     )
  120.      * @ORM\JoinTable(
  121.      *     name="new_bonus_currency",
  122.      *     joinColumns={
  123.      *          @ORM\JoinColumn(name="new_bonus_id", referencedColumnName="id")
  124.      *     },
  125.      *     inverseJoinColumns={
  126.      *          @ORM\JoinColumn(name="currency_id", referencedColumnName="id")
  127.      *     }
  128.      * )
  129.      */
  130.     private Collection $currencies;
  131.     /**
  132.      * @ORM\ManyToMany (
  133.      *     targetEntity="App\CasinoBundle\Entity\Country",
  134.      *     inversedBy="newBonuses",
  135.      *     fetch="EXTRA_LAZY"
  136.      *     )
  137.      * @ORM\JoinTable(
  138.      *     name="new_bonus_country",
  139.      *     joinColumns={
  140.      *          @ORM\JoinColumn(name="new_bonus_id", referencedColumnName="id")
  141.      *     },
  142.      *     inverseJoinColumns={
  143.      *          @ORM\JoinColumn(name="country_id", referencedColumnName="id")
  144.      *     }
  145.      * )
  146.      */
  147.     private Collection $countries;
  148.     /**
  149.      * @ORM\ManyToMany (
  150.      *     targetEntity="App\CasinoBundle\Entity\Slot",
  151.      *     inversedBy="newBonuses",
  152.      *     cascade={"persist"}
  153.      *     )
  154.      * @ORM\JoinTable(
  155.      *     name="new_bonus_slot",
  156.      *     joinColumns={
  157.      *          @ORM\JoinColumn(name="new_bonus_id", referencedColumnName="id")
  158.      *     },
  159.      *     inverseJoinColumns={
  160.      *          @ORM\JoinColumn(name="slot_id", referencedColumnName="id")
  161.      *     }
  162.      * )
  163.      */
  164.     private Collection $slots;
  165.     /**
  166.      * @ORM\OneToMany(targetEntity="App\CasinoBundle\Entity\Alias", mappedBy="newBonus", cascade={"persist"}, orphanRemoval=true)
  167.      */
  168.     private Collection $aliases;
  169.     /**
  170.      * @var string|null
  171.      *
  172.      * @ORM\Column(
  173.      *     name="code",
  174.      *     type="string",
  175.      *     length=255,
  176.      *     nullable=true
  177.      *     )
  178.      */
  179.     private ?string $code null;
  180.     /**
  181.      * @var string|null
  182.      *
  183.      * @ORM\Column(
  184.      *     name="skin_bg",
  185.      *     type="string",
  186.      *     length=255,
  187.      *     nullable=true
  188.      *     )
  189.      */
  190.     private ?string $skinBg null;
  191.     /**
  192.      * @var string|null
  193.      *
  194.      * @ORM\Column(
  195.      *     name="skin_character",
  196.      *     type="string",
  197.      *     length=255,
  198.      *     nullable=true
  199.      *     )
  200.      */
  201.     private ?string $skinCharacter null;
  202.     /**
  203.      * @var string|null
  204.      *
  205.      * @ORM\Column(
  206.      *     name="original_bonus_url",
  207.      *     type="string",
  208.      *     length=255,
  209.      *     nullable=true
  210.      *     )
  211.      */
  212.     private ?string $originalBonusUrl;
  213.     /**
  214.      * @var string|null
  215.      *
  216.      * @ORM\Column(
  217.      *     name="label",
  218.      *     type="string",
  219.      *     length=255,
  220.      *     nullable=true
  221.      *     )
  222.      */
  223.     private ?string $label null;
  224.     /**
  225.      * @ORM\Column(
  226.      *     name="tnc_content",
  227.      *     type="text",
  228.      *     nullable=true
  229.      * )
  230.      */
  231.     private ?string $tncContent null;
  232.     /**
  233.      * @var bool
  234.      *
  235.      * @ORM\Column(
  236.      *     name="special_button_title",
  237.      *     type="boolean",
  238.      *     nullable=true
  239.      *     )
  240.      */
  241.     private ?bool $specialButtonTitle;
  242.     /**
  243.      * @var bool
  244.      *
  245.      * @ORM\Column(
  246.      *     name="animated_button",
  247.      *     type="boolean",
  248.      *     nullable=true
  249.      *     )
  250.      */
  251.     private ?bool $animatedButton;
  252.     /**
  253.      * @var bool
  254.      *
  255.      * @ORM\Column(
  256.      *     name="clone",
  257.      *     type="boolean",
  258.      *     nullable=false,
  259.      *     options={"default":"0"}
  260.      *     )
  261.      */
  262.     private ?bool $clone;
  263.     /**
  264.      * @var bool
  265.      *
  266.      * @ORM\Column(
  267.      *     name="copy_country_from_casino",
  268.      *     type="boolean",
  269.      *     nullable=true
  270.      *     )
  271.      */
  272.     private ?bool $copyCountryFromCasino;
  273.     /**
  274.      * @var bool
  275.      *
  276.      */
  277.     private bool $removeCountries false;
  278.     /**
  279.      * @var bool
  280.      *
  281.      * @ORM\Column(
  282.      *     name="add_all_sites",
  283.      *     type="boolean",
  284.      *     nullable=true,
  285.      *     options={"default":"0"}
  286.      *     )
  287.      */
  288.     private ?bool $addAllSites null;
  289.     /**
  290.      * @var int|null
  291.      *
  292.      * @ORM\Column(
  293.      *     name="deposit_min",
  294.      *     type="float",
  295.      *     nullable=true
  296.      * )
  297.      */
  298.     private ?float $depositMin;
  299.     /**
  300.      * @var string
  301.      *
  302.      * @ORM\Column(
  303.      *     name="wagering_requirements",
  304.      *     type="string",
  305.      *     length=255,
  306.      *     nullable=true
  307.      *     )
  308.      */
  309.     private ?string $wageringRequirements;
  310.     /**
  311.      * @var float|null
  312.      *
  313.      * @ORM\Column(
  314.      *     name="amount_max",
  315.      *     type="float",
  316.      *     nullable=true
  317.      *     )
  318.      */
  319.     private ?float $amountMax null;
  320.     /**
  321.      * @var integer|null
  322.      *
  323.      * @ORM\Column(
  324.      *     name="percent",
  325.      *     type="integer",
  326.      *     nullable=true
  327.      *     )
  328.      */
  329.     private ?int $percent null;
  330.     /**
  331.      * @var integer|null
  332.      *
  333.      * @ORM\Column(
  334.      *     name="free_spins",
  335.      *     type="integer",
  336.      *     nullable=true
  337.      *     )
  338.      */
  339.     private ?int $freeSpins null;
  340.     /**
  341.      * @var bool|null
  342.      *
  343.      * @ORM\Column(
  344.      *     name="cashable",
  345.      *     type="boolean",
  346.      *     nullable=true
  347.      *     )
  348.      */
  349.     private ?bool $cashable null;
  350.     /**
  351.      * @var DateTime|null
  352.      *
  353.      * @ORM\Column(
  354.      *     name="expired_date",
  355.      *     type="datetime",
  356.      *     nullable=true
  357.      *     )
  358.      */
  359.     private ?DateTime $expiredDate null;
  360.     /**
  361.      * @var DateTime|null
  362.      *
  363.      * @ORM\Column(
  364.      *     name="start_published_date",
  365.      *     type="datetime",
  366.      *     nullable=true
  367.      *     )
  368.      */
  369.     private ?DateTime $startPublishedDate;
  370.     /**
  371.      * @var DateTime|null
  372.      *
  373.      * @ORM\Column(
  374.      *     name="end_published_date",
  375.      *     type="datetime",
  376.      *     nullable=true
  377.      *     )
  378.      */
  379.     private ?DateTime $endPublishedDate;
  380.     /**
  381.      * @var string|null
  382.      *
  383.      * @ORM\Column(
  384.      *     name="terms_url",
  385.      *     type="string",
  386.      *     length=255,
  387.      *     nullable=true
  388.      *     )
  389.      */
  390.     private ?string $termsUrl null;
  391.     /**
  392.      * @var string|null
  393.      *
  394.      * @ORM\Column(
  395.      *     name="bonus_url",
  396.      *     type="string",
  397.      *     length=255,
  398.      *     nullable=true
  399.      *     )
  400.      */
  401.     private ?string $bonusUrl null;
  402.     /**
  403.      * @var string|null
  404.      *
  405.      * @ORM\Column(name="max_cashout", type="string", length=255, nullable=true)
  406.      */
  407.     protected ?string $maxCashout null;
  408.     /**
  409.      * @var string|null
  410.      *
  411.      * @ORM\Column(name="max_bet", type="string", length=255, nullable=true)
  412.      */
  413.     protected ?string $maxBet null;
  414.     /**
  415.      * @var string|null
  416.      *
  417.      * @ORM\Column(name="free_spins_conditions", type="string", length=255, nullable=true)
  418.      */
  419.     protected ?string $freeSpinsConditions null;
  420.     /**
  421.      * @var integer
  422.      *
  423.      * @ORM\Column(name="expires_after", type="integer", nullable=true)
  424.      */
  425.     private $expiresAfter;
  426.     /**
  427.      * @ORM\Column(type="boolean", nullable=false, options={"default" = false})
  428.      */
  429.     private bool $sponsored false;
  430.     /**
  431.      * @ORM\OneToMany(
  432.      *     targetEntity=BonusTag::class,
  433.      *     mappedBy="newBonus",
  434.      *     cascade={"persist"},
  435.      *     orphanRemoval=true
  436.      * )
  437.      */
  438.     private Collection $bonusTags;
  439.     /**
  440.      * @var int
  441.      *
  442.      * @ORM\Column(name="offer_type", type="integer", nullable=false, options={"default" = 0})
  443.      */
  444.     private int $offerType 0;
  445.     /**
  446.      * @var float
  447.      *
  448.      * @ORM\Column(name="bonus_generosity", type="float", nullable=false, options={"default" = 0})
  449.      */
  450.     private float $bonusGenerosity 0.0;
  451.     /**
  452.      * @var float
  453.      *
  454.      * @ORM\Column(name="summator", type="float", nullable=false, options={"default" = 0})
  455.      */
  456.     private float $summator 0.0;
  457.     /**
  458.      * @ORM\ManyToMany (
  459.      *     targetEntity="App\CmsBundle\Entity\Site",
  460.      *     inversedBy="newBonuses",
  461.      *     cascade={"persist"},
  462.      * )
  463.      * @ORM\JoinTable(
  464.      *     name="new_bonus_site",
  465.      *     joinColumns={
  466.      *          @ORM\JoinColumn(name="new_bonus_id", referencedColumnName="id")
  467.      *     },
  468.      *     inverseJoinColumns={
  469.      *          @ORM\JoinColumn(name="site_id", referencedColumnName="id")
  470.      *     }
  471.      * )
  472.      */
  473.     private Collection $sites;
  474.     /**
  475.      * @ORM\OneToMany(
  476.      *     targetEntity="App\CasinoBundle\Entity\IssueReport",
  477.      *     mappedBy="newBonus",
  478.      *     cascade={"persist"},
  479.      *     orphanRemoval=true
  480.      * )
  481.      */
  482.     private Collection $issueReports;
  483.     /**
  484.      * @ORM\OneToMany(
  485.      *     targetEntity="App\CasinoBundle\Entity\UserBonus",
  486.      *     mappedBy="bonus",
  487.      *     cascade={"persist", "remove"}
  488.      * )
  489.      */
  490.     private Collection $bonusOwners;
  491.     /**
  492.      * @ORM\OneToMany(
  493.      *   targetEntity="App\CasinoBundle\Entity\BonusTitle",
  494.      *   mappedBy="bonus",
  495.      *   cascade={"persist","remove"},
  496.      *   orphanRemoval=true
  497.      * )
  498.      */
  499.     private Collection $titles;
  500.     /**
  501.      * @var ?int
  502.      *
  503.      * @ORM\Column(name="price", type="integer", nullable=true)
  504.      */
  505.     private ?int $price null;
  506.     /**
  507.      * NewBonus constructor.
  508.      */
  509.     public function __construct()
  510.     {
  511.         $this->casino null;
  512.         $this->bonusTypes = new ArrayCollection();
  513.         $this->bonusCategories = new ArrayCollection();
  514.         $this->sites = new ArrayCollection();
  515.         $this->countries = new ArrayCollection();
  516.         $this->currencies = new ArrayCollection();
  517.         $this->slots = new ArrayCollection();
  518.         $this->aliases = new ArrayCollection();
  519.         $this->bonusTags = new ArrayCollection();
  520.         $this->issueReports = new ArrayCollection();
  521.         $this->bonusOwners = new ArrayCollection();
  522.         $this->titles = new ArrayCollection();
  523.     }
  524.     /**
  525.      * @return Casino|null
  526.      */
  527.     public function getCasino(): ?Casino
  528.     {
  529.         return $this->casino;
  530.     }
  531.     /**
  532.      * @param Casino $casino
  533.      * @return $this
  534.      */
  535.     public function setCasino(Casino $casino): self
  536.     {
  537.         $this->casino $casino;
  538.         return $this;
  539.     }
  540.     /**
  541.      * @return Collection|ArrayCollection|BonusType[]
  542.      */
  543.     public function getBonusTypes(): Collection
  544.     {
  545.         return $this->bonusTypes;
  546.     }
  547.     /**
  548.      * @param BonusType $bonusType
  549.      * @return $this
  550.      */
  551.     public function addBonusType(BonusType $bonusType): self
  552.     {
  553.         if (!$this->bonusTypes->contains($bonusType)) {
  554.             $this->bonusTypes[] = $bonusType;
  555.             $bonusType->addNewBonus($this);
  556.             $this->addCollectionLog(LogActionEnum::ADD'bonusType'$bonusType);
  557.         }
  558.         return $this;
  559.     }
  560.     /**
  561.      * @param BonusType $bonusType
  562.      * @return $this
  563.      */
  564.     public function removeBonusType(BonusType $bonusType): self
  565.     {
  566.         if ($this->bonusTypes->contains($bonusType)) {
  567.             $this->bonusTypes->removeElement($bonusType);
  568.             $bonusType->removeNewBonus($this);
  569.             $this->addCollectionLog(LogActionEnum::REMOVE'bonusType'$bonusType);
  570.         }
  571.         return $this;
  572.     }
  573.     /**
  574.      * @return Collection|BonusCategory[]
  575.      */
  576.     public function getBonusCategories(): Collection
  577.     {
  578.         return $this->bonusCategories;
  579.     }
  580.     /**
  581.      * @param BonusCategory $bonusCategory
  582.      * @return $this
  583.      */
  584.     public function addBonusCategory(BonusCategory $bonusCategory): self
  585.     {
  586.         if (!$this->bonusCategories->contains($bonusCategory)) {
  587.             $this->bonusCategories[] = $bonusCategory;
  588.             $bonusCategory->addNewBonus($this);
  589.             $this->addCollectionLog(LogActionEnum::ADD'bonusCategory'$bonusCategory);
  590.         }
  591.         return $this;
  592.     }
  593.     /**
  594.      * @param BonusCategory $bonusCategory
  595.      * @return $this
  596.      */
  597.     public function removeBonusCategory(BonusCategory $bonusCategory): self
  598.     {
  599.         if ($this->bonusCategories->contains($bonusCategory)) {
  600.             $this->bonusCategories->removeElement($bonusCategory);
  601.             $bonusCategory->removeNewBonus($this);
  602.             $this->addCollectionLog(LogActionEnum::REMOVE'bonusCategory'$bonusCategory);
  603.         }
  604.         return $this;
  605.     }
  606.     /**
  607.      * @return Collection|Currency[]
  608.      */
  609.     public function getCurrencies(): Collection
  610.     {
  611.         return $this->currencies;
  612.     }
  613.     /**
  614.      * @param Currency $currency
  615.      * @return $this
  616.      */
  617.     public function addCurrency(Currency $currency): self
  618.     {
  619.         if (!$this->currencies->contains($currency)) {
  620.             $this->currencies[] = $currency;
  621.             $currency->addNewBonus($this);
  622.             $this->addCollectionLog(LogActionEnum::ADD'currency'$currency);
  623.         }
  624.         return $this;
  625.     }
  626.     /**
  627.      * @param Currency $currency
  628.      * @return $this
  629.      */
  630.     public function removeCurrency(Currency $currency): self
  631.     {
  632.         if ($this->currencies->contains($currency)) {
  633.             $this->currencies->removeElement($currency);
  634.             $currency->removeNewBonus($this);
  635.             $this->addCollectionLog(LogActionEnum::REMOVE'currency'$currency);
  636.         }
  637.         return $this;
  638.     }
  639.     /**
  640.      * @return Collection
  641.      */
  642.     public function getSites(): Collection
  643.     {
  644.         return $this->sites;
  645.     }
  646.     /**
  647.      * @param Site $site
  648.      * @return $this
  649.      */
  650.     public function addSite(Site $site): self
  651.     {
  652.         if (!$this->sites->contains($site)) {
  653.             $this->sites[] = $site;
  654.             $site->addNewBonus($this);
  655.             $this->addCollectionLog(LogActionEnum::ADD'site'$site);
  656.         }
  657.         return $this;
  658.     }
  659.     /**
  660.      * @param Site $site
  661.      * @return $this
  662.      */
  663.     public function removeSite(Site $site): self
  664.     {
  665.         if ($this->sites->contains($site)) {
  666.             $this->sites->removeElement($site);
  667.             $site->removeNewBonus($this);
  668.             $this->addCollectionLog(LogActionEnum::REMOVE'site'$site);
  669.         }
  670.         return $this;
  671.     }
  672.     /**
  673.      * @return Collection|Country[]
  674.      */
  675.     public function getCountries(): Collection
  676.     {
  677.         return $this->countries;
  678.     }
  679.     /**
  680.      * @param Country $country
  681.      * @return $this
  682.      */
  683.     public function addCountry(Country $country): self
  684.     {
  685.         if (!$this->countries->contains($country)) {
  686.             $this->countries[] = $country;
  687.             $country->addNewBonus($this);
  688.             $this->addCollectionLog(LogActionEnum::ADD'country'$country);
  689.         }
  690.         return $this;
  691.     }
  692.     /**
  693.      * @param Country $country
  694.      * @return $this
  695.      */
  696.     public function removeCountry(Country $country): self
  697.     {
  698.         if ($this->countries->contains($country)) {
  699.             $this->countries->removeElement($country);
  700.             $country->removeNewBonus($this);
  701.             $this->addCollectionLog(LogActionEnum::REMOVE'country'$country);
  702.         }
  703.         return $this;
  704.     }
  705.     /**
  706.      * @return bool
  707.      */
  708.     public function getRemoveCountries(): bool
  709.     {
  710.         return $this->removeCountries;
  711.     }
  712.     /**
  713.      * @param bool $removeCountries
  714.      * @return NewBonus
  715.      */
  716.     public function setRemoveCountries(bool $removeCountries): self
  717.     {
  718.         $this->removeCountries $removeCountries;
  719.         return $this;
  720.     }
  721.     /**
  722.      * @return Collection|Slot[]
  723.      */
  724.     public function getSlots(): Collection
  725.     {
  726.         return $this->slots;
  727.     }
  728.     /**
  729.      * @param Slot $slot
  730.      * @return $this
  731.      */
  732.     public function addSlot(Slot $slot): self
  733.     {
  734.         if (!$this->slots->contains($slot)) {
  735.             $this->slots[] = $slot;
  736.             $slot->addNewBonus($this);
  737.             $this->addCollectionLog(LogActionEnum::ADD'slot'$slot);
  738.         }
  739.         return $this;
  740.     }
  741.     /**
  742.      * @param Slot $slot
  743.      * @return $this
  744.      */
  745.     public function removeSlot(Slot $slot): self
  746.     {
  747.         if ($this->slots->contains($slot)) {
  748.             $this->slots->removeElement($slot);
  749.             $slot->removeNewBonus($this);
  750.             $this->addCollectionLog(LogActionEnum::REMOVE'slot'$slot);
  751.         }
  752.         return $this;
  753.     }
  754.     /**
  755.      * @return Collection|IssueReport[]
  756.      */
  757.     public function getIssueReports()
  758.     {
  759.         return $this->issueReports;
  760.     }
  761.     /**
  762.      * @param IssueReport $issueReport
  763.      * @return $this
  764.      */
  765.     public function addIssueReport(IssueReport $issueReport): self
  766.     {
  767.         if (!$this->issueReports->contains($issueReport)) {
  768.             $this->issueReports[] = $issueReport;
  769.             $issueReport->setNewBonus($this);
  770.             $this->addCollectionLog(LogActionEnum::ADD'issueReport'$issueReport);
  771.         }
  772.         return $this;
  773.     }
  774.     /**
  775.      * @param IssueReport $issueReport
  776.      * @return $this
  777.      */
  778.     public function removeIssueReport(IssueReport $issueReport): self
  779.     {
  780.         if ($this->issueReports->contains($issueReport)) {
  781.             $this->issueReports->removeElement($issueReport);
  782.             $issueReport->setNewBonus(null);
  783.             $this->addCollectionLog(LogActionEnum::REMOVE'issueReport'$issueReport);
  784.         }
  785.         return $this;
  786.     }
  787.     /**
  788.      * @return string|null
  789.      */
  790.     public function getTncContent(): ?string
  791.     {
  792.         return $this->tncContent;
  793.     }
  794.     /**
  795.      * @param string|null $tncContent
  796.      * @return $this
  797.      */
  798.     public function setTncContent(?string $tncContent): self
  799.     {
  800.         $this->tncContent $tncContent;
  801.         return $this;
  802.     }
  803.     /**
  804.      * @return string|null
  805.      */
  806.     public function getCode(): ?string
  807.     {
  808.         return $this->code;
  809.     }
  810.     /**
  811.      * @param string|null $code
  812.      * @return $this
  813.      */
  814.     public function setCode(?string $code): self
  815.     {
  816.         $this->code $code;
  817.         return $this;
  818.     }
  819.     /**
  820.      * @return string|null
  821.      */
  822.     public function getSkinBg(): ?string
  823.     {
  824.         return $this->skinBg;
  825.     }
  826.     /**
  827.      * @param string|null $skinBg
  828.      * @return $this
  829.      */
  830.     public function setSkinBg(?string $skinBg): self
  831.     {
  832.         $this->skinBg $skinBg;
  833.         return $this;
  834.     }
  835.     /**
  836.      * @return string|null
  837.      */
  838.     public function getSkinCharacter(): ?string
  839.     {
  840.         return $this->skinCharacter;
  841.     }
  842.     /**
  843.      * @param string|null $skinCharacter
  844.      * @return $this
  845.      */
  846.     public function setSkinCharacter(?string $skinCharacter): self
  847.     {
  848.         $this->skinCharacter $skinCharacter;
  849.         return $this;
  850.     }
  851.     /**
  852.      * @return bool|null
  853.      */
  854.     public function getSpecialButtonTitle(): ?bool
  855.     {
  856.         return $this->specialButtonTitle;
  857.     }
  858.     /**
  859.      * @param bool|null $specialButtonTitle
  860.      * @return $this
  861.      */
  862.     public function setSpecialButtonTitle(?bool $specialButtonTitle): self
  863.     {
  864.         $this->specialButtonTitle $specialButtonTitle;
  865.         return $this;
  866.     }
  867.     /**
  868.      * @return bool|null
  869.      */
  870.     public function getAnimatedButton(): ?bool
  871.     {
  872.         return $this->animatedButton;
  873.     }
  874.     /**
  875.      * @param bool|null $animatedButton
  876.      * @return $this
  877.      */
  878.     public function setAnimatedButton(?bool $animatedButton): self
  879.     {
  880.         $this->animatedButton $animatedButton;
  881.         return $this;
  882.     }
  883.     /**
  884.      * @return bool
  885.      */
  886.     public function getClone(): bool
  887.     {
  888.         return $this->clone;
  889.     }
  890.     /**
  891.      * @param bool|null $clone
  892.      * @return $this
  893.      */
  894.     public function setClone(bool $clone): self
  895.     {
  896.         $this->clone $clone;
  897.         return $this;
  898.     }
  899.     /**
  900.      * @return bool|null
  901.      */
  902.     public function getCopyCountryFromCasino(): ?bool
  903.     {
  904.         return $this->copyCountryFromCasino;
  905.     }
  906.     /**
  907.      * @param bool|null $copyCountryFromCasino
  908.      * @return $this
  909.      */
  910.     public function setCopyCountryFromCasino(?bool $copyCountryFromCasino): self
  911.     {
  912.         $this->copyCountryFromCasino $copyCountryFromCasino;
  913.         return $this;
  914.     }
  915.     /**
  916.      * @return bool|null
  917.      */
  918.     public function getAddAllSites(): ?bool
  919.     {
  920.         return $this->addAllSites;
  921.     }
  922.     /**
  923.      * @param bool|null $addAllSites
  924.      * @return $this
  925.      */
  926.     public function setAddAllSites(?bool $addAllSites): self
  927.     {
  928.         $this->addAllSites $addAllSites;
  929.         return $this;
  930.     }
  931.     /**
  932.      * @return float|null
  933.      */
  934.     public function getDepositMin(): ?float
  935.     {
  936.         return $this->depositMin;
  937.     }
  938.     /**
  939.      * @param float|null $depositMin
  940.      * @return $this
  941.      */
  942.     public function setDepositMin(?float $depositMin): self
  943.     {
  944.         $this->depositMin $depositMin;
  945.         return $this;
  946.     }
  947.     /**
  948.      * @return string|null
  949.      */
  950.     public function getWageringRequirements(): ?string
  951.     {
  952.         return $this->wageringRequirements;
  953.     }
  954.     /**
  955.      * @param string|null $wageringRequirements
  956.      * @return $this
  957.      */
  958.     public function setWageringRequirements(?string $wageringRequirements): self
  959.     {
  960.         $this->wageringRequirements $wageringRequirements;
  961.         return $this;
  962.     }
  963.     /**
  964.      * @return int|null
  965.      */
  966.     public function getFreeSpins(): ?int
  967.     {
  968.         return $this->freeSpins;
  969.     }
  970.     /**
  971.      * @param int|null $freeSpins
  972.      * @return $this
  973.      */
  974.     public function setFreeSpins(?int $freeSpins): self
  975.     {
  976.         $this->freeSpins $freeSpins;
  977.         return $this;
  978.     }
  979.     /**
  980.      * @return int|null
  981.      */
  982.     public function getPercent(): ?int
  983.     {
  984.         return $this->percent;
  985.     }
  986.     /**
  987.      * @param int|null $percent
  988.      * @return $this
  989.      */
  990.     public function setPercent(?int $percent): self
  991.     {
  992.         $this->percent $percent;
  993.         return $this;
  994.     }
  995.     /**
  996.      * @return float|null
  997.      */
  998.     public function getAmountMax(): ?float
  999.     {
  1000.         return $this->amountMax;
  1001.     }
  1002.     /**
  1003.      * @param float|null $amountMax
  1004.      * @return $this
  1005.      */
  1006.     public function setAmountMax(?float $amountMax): self
  1007.     {
  1008.         $this->amountMax $amountMax;
  1009.         return $this;
  1010.     }
  1011.     /**
  1012.      * @return bool|null
  1013.      */
  1014.     public function getCashable(): ?bool
  1015.     {
  1016.         return $this->cashable;
  1017.     }
  1018.     /**
  1019.      * @param bool|null $cashable
  1020.      * @return $this
  1021.      */
  1022.     public function setCashable(?bool $cashable): self
  1023.     {
  1024.         $this->cashable $cashable;
  1025.         return $this;
  1026.     }
  1027.     /**
  1028.      * @return string|null
  1029.      */
  1030.     public function getTermsUrl(): ?string
  1031.     {
  1032.         return $this->termsUrl;
  1033.     }
  1034.     /**
  1035.      * @param string|null $termsUrl
  1036.      * @return $this
  1037.      */
  1038.     public function setTermsUrl(?string $termsUrl): self
  1039.     {
  1040.         $this->termsUrl $termsUrl;
  1041.         return $this;
  1042.     }
  1043.     /**
  1044.      * @return string|null
  1045.      */
  1046.     public function getBonusUrl(): ?string
  1047.     {
  1048.         return $this->bonusUrl;
  1049.     }
  1050.     /**
  1051.      * @param string|null $bonusUrl
  1052.      * @return $this
  1053.      */
  1054.     public function setBonusUrl(?string $bonusUrl): self
  1055.     {
  1056.         $this->bonusUrl $bonusUrl;
  1057.         return $this;
  1058.     }
  1059.     /**
  1060.      * @return string|null
  1061.      */
  1062.     public function getOriginalBonusUrl(): ?string
  1063.     {
  1064.         return $this->originalBonusUrl;
  1065.     }
  1066.     /**
  1067.      * @param string|null $originalBonusUrl
  1068.      * @return $this
  1069.      */
  1070.     public function setOriginalBonusUrl(?string $originalBonusUrl): self
  1071.     {
  1072.         $this->originalBonusUrl $originalBonusUrl;
  1073.         return $this;
  1074.     }
  1075.     /**
  1076.      * @return string|null
  1077.      */
  1078.     public function getLabel(): ?string
  1079.     {
  1080.         return $this->label;
  1081.     }
  1082.     /**
  1083.      * @param string|null $label
  1084.      * @return $this
  1085.      */
  1086.     public function setLabel(?string $label): self
  1087.     {
  1088.         $this->label $label;
  1089.         return $this;
  1090.     }
  1091.     /**
  1092.      * @return DateTime|null
  1093.      */
  1094.     public function getExpiredDate(): ?DateTime
  1095.     {
  1096.         return $this->expiredDate;
  1097.     }
  1098.     /**
  1099.      * @param DateTime|null $expiredDate
  1100.      * @return $this
  1101.      */
  1102.     public function setExpiredDate(?DateTime $expiredDate): self
  1103.     {
  1104.         $this->expiredDate $expiredDate;
  1105.         return $this;
  1106.     }
  1107.     /**
  1108.      * @return DateTime|null
  1109.      */
  1110.     public function getStartPublishedDate(): ?DateTime
  1111.     {
  1112.         return $this->startPublishedDate;
  1113.     }
  1114.     /**
  1115.      * @param DateTime|null $startPublishedDate
  1116.      * @return $this
  1117.      */
  1118.     public function setStartPublishedDate(?DateTime $startPublishedDate): self
  1119.     {
  1120.         $this->startPublishedDate $startPublishedDate;
  1121.         return $this;
  1122.     }
  1123.     /**
  1124.      * @return DateTime|null
  1125.      */
  1126.     public function getEndPublishedDate(): ?DateTime
  1127.     {
  1128.         return $this->endPublishedDate;
  1129.     }
  1130.     /**
  1131.      * @param DateTime|null $endPublishedDate
  1132.      * @return $this
  1133.      */
  1134.     public function setEndPublishedDate(?DateTime $endPublishedDate): self
  1135.     {
  1136.         $this->endPublishedDate $endPublishedDate;
  1137.         return $this;
  1138.     }
  1139.     /**
  1140.      * @return $this
  1141.      * @deprecated
  1142.      */
  1143.     public function setCache(): self
  1144.     {
  1145.         /* do not use this method. functionality moved to db side */
  1146.         /** @var Country $country */
  1147.         $this->cache json_encode([
  1148.             'currency' => ($currencies $this->getCurrencies()) ? array_map(function ($currency) {
  1149.                 return $currency->getAlphabeticCode();
  1150.             }, $currencies->toArray()) : null,
  1151.             'bonusTypes' => ($bonuses $this->getBonusTypes()) ? array_map(function ($bonus) {
  1152.                 return ['name' => $bonus->getName(), 'slug' => $bonus->getSlug()];
  1153.             }, $bonuses->toArray()) : null,
  1154.             'slots' => ($slots $this->getSlots()) ? array_map(function ($slot) {
  1155.                 return ['name' => $slot->getName(), 'slug' => $slot->getSlug()];
  1156.             }, $slots->toArray()) : null,
  1157.             'bonusCategories' => ($categories $this->getBonusCategories()) ? array_map(function ($category) {
  1158.                 return ['name' => $category->getName(), 'slug' => $category->getSlug(), 'type' => ($type $category->getBonusType()) ? $category->getBonusType()->getSlug() : null];
  1159.             }, $categories->toArray()) : null,
  1160.             'casinoRestrictedCountries' => ($restrictedCountries $this->getCasino()->getRestrictedCountriesFact()) ? array_map(function ($country) {
  1161.                 return $country->getAlpha2();
  1162.             }, $restrictedCountries->toArray()) : null,
  1163.             'affiliateUrl' => $this->getCasino()->getInfo()->getAffiliateUrl(),
  1164.         ]);
  1165.         return $this;
  1166.     }
  1167.     /**
  1168.      * @return string
  1169.      */
  1170.     public function getTitleShort(): ?string
  1171.     {
  1172.         return $this->titleShort;
  1173.     }
  1174.     /**
  1175.      * @param string|null $titleShort
  1176.      * @return $this
  1177.      */
  1178.     public function setTitleShort(?string $titleShort): self
  1179.     {
  1180.         $this->titleShort $titleShort;
  1181.         return $this;
  1182.     }
  1183.     /**
  1184.      * @return string
  1185.      */
  1186.     public function getMaxCashout(): ?string
  1187.     {
  1188.         return $this->maxCashout;
  1189.     }
  1190.     public function setMaxCashout(?string $maxCashout): self
  1191.     {
  1192.         $this->maxCashout $maxCashout;
  1193.         return $this;
  1194.     }
  1195.     /**
  1196.      * @return string
  1197.      */
  1198.     public function getMaxBet(): ?string
  1199.     {
  1200.         return $this->maxBet;
  1201.     }
  1202.     public function setMaxBet(?string $maxBet): self
  1203.     {
  1204.         $this->maxBet $maxBet;
  1205.         return $this;
  1206.     }
  1207.     /**
  1208.      * @return string
  1209.      */
  1210.     public function getFreeSpinsConditions(): ?string
  1211.     {
  1212.         return $this->freeSpinsConditions;
  1213.     }
  1214.     public function setFreeSpinsConditions(?string $freeSpinsConditions): self
  1215.     {
  1216.         $this->freeSpinsConditions $freeSpinsConditions;
  1217.         return $this;
  1218.     }
  1219.     public function getExpiresAfter(): ?int
  1220.     {
  1221.         return $this->expiresAfter;
  1222.     }
  1223.     public function setExpiresAfter(?int $expiresAfter): self
  1224.     {
  1225.         $this->expiresAfter $expiresAfter;
  1226.         return $this;
  1227.     }
  1228.     public function getName(): string
  1229.     {
  1230.         return $this->getTitleShort();
  1231.     }
  1232.     /**
  1233.      * @param bool $sponsored
  1234.      * @return self
  1235.      */
  1236.     public function setSponsored(bool $sponsored): self
  1237.     {
  1238.         $this->sponsored $sponsored;
  1239.         return $this;
  1240.     }
  1241.     /**
  1242.      * @return ?bool
  1243.      */
  1244.     public function getSponsored(): ?bool
  1245.     {
  1246.         return $this->sponsored;
  1247.     }
  1248.     /**
  1249.      * @return ?int
  1250.      */
  1251.     public function getOfferType(): ?int
  1252.     {
  1253.         return $this->offerType;
  1254.     }
  1255.     /**
  1256.      * @param ?int $type
  1257.      * @return $this
  1258.      */
  1259.     public function setOfferType(?int $type): self
  1260.     {
  1261.         BonusOfferTypeEnum::assertExists($type);
  1262.         $this->offerType $type;
  1263.         return $this;
  1264.     }
  1265.     /**
  1266.      * @return Collection
  1267.      */
  1268.     public function getBonusTags(): Collection
  1269.     {
  1270.         return $this->bonusTags;
  1271.     }
  1272.     /**
  1273.      * @return int
  1274.      */
  1275.     public function getBonusTagsCount(): int
  1276.     {
  1277.         return $this->bonusTags->count();
  1278.     }
  1279.     /**
  1280.      * @param BonusTag $bonusTag
  1281.      * @return $this
  1282.      */
  1283.     public function addBonusTag(BonusTag $bonusTag): self
  1284.     {
  1285.         if (!$this->bonusTags->contains($bonusTag)) {
  1286.             $this->bonusTags[] = $bonusTag;
  1287.             $bonusTag->setNewBonus($this);
  1288.         }
  1289.         return $this;
  1290.     }
  1291.     /**
  1292.      * @param BonusTag $bonusTag
  1293.      * @return $this
  1294.      */
  1295.     public function removeBonusTag(BonusTag $bonusTag): self
  1296.     {
  1297.         if ($this->bonusTags->contains($bonusTag)) {
  1298.             $this->bonusTags->removeElement($bonusTag);
  1299.         }
  1300.         return $this;
  1301.     }
  1302.     /**
  1303.      * @return float
  1304.      */
  1305.     public function getBonusGenerosity(): float
  1306.     {
  1307.         return $this->bonusGenerosity;
  1308.     }
  1309.     /**
  1310.      * @param float $bonusGenerosity
  1311.      * @return $this
  1312.      */
  1313.     public function setBonusGenerosity(float $bonusGenerosity): self
  1314.     {
  1315.         $this->bonusGenerosity $bonusGenerosity;
  1316.         return $this;
  1317.     }
  1318.     /**
  1319.      * @return float
  1320.      */
  1321.     public function getSummator(): float
  1322.     {
  1323.         return $this->summator;
  1324.     }
  1325.     /**
  1326.      * @param float $summator
  1327.      * @return $this
  1328.      */
  1329.     public function setSummator(float $summator): self
  1330.     {
  1331.         $this->summator $summator;
  1332.         return $this;
  1333.     }
  1334.     /**
  1335.      * @return Collection
  1336.      */
  1337.     public function getBonusOwners(): Collection
  1338.     {
  1339.         return $this->bonusOwners;
  1340.     }
  1341.     /**
  1342.      * @param UserBonus $userBonus
  1343.      * @return $this
  1344.      */
  1345.     public function addBonusOwner(UserBonus $userBonus): self
  1346.     {
  1347.         if (!$this->bonusOwners->contains($userBonus)) {
  1348.             $this->bonusOwners[] = $userBonus;
  1349.             $userBonus->setBonus($this);
  1350.         }
  1351.         return $this;
  1352.     }
  1353.     /**
  1354.      * @param UserBonus $userBonus
  1355.      * @return $this
  1356.      */
  1357.     public function removeBonusOwner(UserBonus $userBonus): self
  1358.     {
  1359.         if ($this->bonusOwners->removeElement($userBonus)) {
  1360.             if ($userBonus->getBonus() === $this) {
  1361.                 $userBonus->setBonus(null);
  1362.             }
  1363.         }
  1364.         return $this;
  1365.     }
  1366.     /**
  1367.      * @return ?int
  1368.      */
  1369.     public function getPrice(): ?int
  1370.     {
  1371.         return $this->price;
  1372.     }
  1373.     /**
  1374.      * @param ?int $price
  1375.      * @return $this
  1376.      */
  1377.     public function setPrice(?int $price): self
  1378.     {
  1379.         $this->price $price;
  1380.         return $this;
  1381.     }
  1382.     /**
  1383.      * @return Collection
  1384.      */
  1385.     public function getTitles(): Collection
  1386.     {
  1387.         return $this->titles;
  1388.     }
  1389.     /**
  1390.      * @param BonusTitle $bonusTitle
  1391.      * @return $this
  1392.      */
  1393.     public function addTitle(BonusTitle $bonusTitle): self
  1394.     {
  1395.         if (!$this->titles->contains($bonusTitle)) {
  1396.             $this->titles->add($bonusTitle);
  1397.             $bonusTitle->setBonus($this);
  1398.         }
  1399.         return $this;
  1400.     }
  1401.     /**
  1402.      * @param BonusTitle $bonusTitle
  1403.      * @return $this
  1404.      */
  1405.     public function removeTitle(BonusTitle $bonusTitle): self
  1406.     {
  1407.         if ($this->titles->removeElement($bonusTitle) && $bonusTitle->getBonus() === $this) {
  1408.             $bonusTitle->setBonus(null);
  1409.         }
  1410.         return $this;
  1411.     }
  1412. }