src/GamificationBundle/Entity/UserBonus.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\GamificationBundle\Entity;
  3. use App\CasinoBundle\Entity\NewBonus;
  4. use App\CmsBundle\Entity\TimeStampedTrait;
  5. use App\ProfileBundle\Entity\User;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Table(
  9.  *     name="user_bonus",
  10.  *     uniqueConstraints={@ORM\UniqueConstraint(name="unique_user_bonus", columns={"user_id", "bonus_id"})}
  11.  * )
  12.  *
  13.  * @ORM\Entity(repositoryClass="App\GamificationBundle\Repository\UserBonusRepository")
  14.  */
  15. class UserBonus
  16. {
  17.     use TimeStampedTrait;
  18.     /**
  19.      * @ORM\Column(name="id", type="bigint", nullable=false)
  20.      * @ORM\Id
  21.      * @ORM\GeneratedValue(strategy="IDENTITY")
  22.      */
  23.     private int $id;
  24.     /**
  25.      * @ORM\Column(name="is_mystery", type="boolean", nullable=false, options={"default"=false})
  26.      */
  27.     private bool $isMystery false;
  28.     /**
  29.      * @ORM\ManyToOne(
  30.      *     targetEntity="App\ProfileBundle\Entity\User",
  31.      *     inversedBy="ownedBonuses"
  32.      * )
  33.      * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
  34.      */
  35.     private ?User $user null;
  36.     /**
  37.      * @ORM\ManyToOne(
  38.      *     targetEntity="App\CasinoBundle\Entity\NewBonus",
  39.      *     inversedBy="bonusOwnersUsers"
  40.      * )
  41.      * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
  42.      */
  43.     private ?NewBonus $bonus null;
  44.     /**
  45.      * @return bool
  46.      */
  47.     public function isMystery(): bool
  48.     {
  49.         return $this->isMystery;
  50.     }
  51.     /**
  52.      * @param bool $isMystery
  53.      * @return $this
  54.      */
  55.     public function setIsMystery(bool $isMystery): self
  56.     {
  57.         $this->isMystery $isMystery;
  58.         return $this;
  59.     }
  60.     /**
  61.      * @return ?User
  62.      */
  63.     public function getUser(): ?User
  64.     {
  65.         return $this->user;
  66.     }
  67.     /**
  68.      * @param ?User $user
  69.      * @return $this
  70.      */
  71.     public function setUser(?User $user): self
  72.     {
  73.         $this->user $user;
  74.         return $this;
  75.     }
  76.     /**
  77.      * @return ?NewBonus
  78.      */
  79.     public function getBonus(): ?NewBonus
  80.     {
  81.         return $this->bonus;
  82.     }
  83.     /**
  84.      * @param ?NewBonus $bonus
  85.      * @return $this
  86.      */
  87.     public function setBonus(?NewBonus $bonus): self
  88.     {
  89.         $this->bonus $bonus;
  90.         return $this;
  91.     }
  92. }