<?phpnamespace App\CasinoBundle\Entity;use App\CmsBundle\Entity\IdTrait;use App\CmsBundle\Entity\TimeStampedTrait;use App\ProfileBundle\Entity\User;use Doctrine\ORM\Mapping as ORM;/** * @ORM\Entity(repositoryClass="App\CasinoBundle\Repository\BonusReactionRepository") * @ORM\Table( * name="bonus_reactions", * uniqueConstraints={ * @ORM\UniqueConstraint(name="uniq_bonus_user", columns={"bonus_id", "user_id"}) * } * ) */class BonusReaction{ use IdTrait, TimeStampedTrait; /** * @ORM\ManyToOne(targetEntity="App\CasinoBundle\Entity\NewBonus", inversedBy="reactions") * @ORM\JoinColumn(nullable=false, onDelete="CASCADE") */ private ?NewBonus $bonus = null; /** * @ORM\ManyToOne(targetEntity="App\ProfileBundle\Entity\User", inversedBy="bonusReactions") * @ORM\JoinColumn(nullable=false, onDelete="CASCADE") */ private ?User $user = null; /** * @ORM\Column(type="smallint") */ private int $reactionType; /** * @return NewBonus|null */ public function getBonus(): ?NewBonus { return $this->bonus; } /** * @param NewBonus|null $bonus * @return $this */ public function setBonus(?NewBonus $bonus): self { $this->bonus = $bonus; return $this; } /** * @return User|null */ public function getUser(): ?User { return $this->user; } /** * @param User|null $user * @return $this */ public function setUser(?User $user): self { $this->user = $user; return $this; } /** * @return int */ public function getReactionType(): int { return $this->reactionType; } /** * @param int $reactionType * @return $this */ public function setReactionType(int $reactionType): self { $this->reactionType = $reactionType; return $this; } /** * @return bool */ public function isLike(): bool { return $this->reactionType === 1; } /** * @return bool */ public function isDislike(): bool { return $this->reactionType === -1; }}