src/Entity/ShopReviewVote.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ShopReviewVoteRepository;
  4. use Doctrine\DBAL\Types\Types;
  5. use Doctrine\ORM\Mapping as ORM;
  6. #[ORM\Entity(repositoryClassShopReviewVoteRepository::class)]
  7. #[ORM\Table(name'shop_review_votes')]
  8. #[ORM\UniqueConstraint(name'unique_user_review_vote'columns: ['user_id''review_id'])]
  9. class ShopReviewVote
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column]
  14.     private ?int $id null;
  15.     #[ORM\ManyToOne(targetEntityUser::class)]
  16.     #[ORM\JoinColumn(nullablefalse)]
  17.     private ?User $user null;
  18.     #[ORM\ManyToOne(targetEntityShopReview::class, inversedBy'votes')]
  19.     #[ORM\JoinColumn(nullablefalseonDelete'CASCADE')]
  20.     private ?ShopReview $review null;
  21.     #[ORM\Column(typeTypes::BOOLEAN)]
  22.     private bool $isHelpful false;
  23.     #[ORM\Column(typeTypes::DATETIME_IMMUTABLE)]
  24.     private ?\DateTimeImmutable $createdAt null;
  25.     public function __construct()
  26.     {
  27.         $this->createdAt = new \DateTimeImmutable();
  28.     }
  29.     public function getId(): ?int
  30.     {
  31.         return $this->id;
  32.     }
  33.     public function getUser(): ?User
  34.     {
  35.         return $this->user;
  36.     }
  37.     public function setUser(?User $user): static
  38.     {
  39.         $this->user $user;
  40.         return $this;
  41.     }
  42.     public function getReview(): ?ShopReview
  43.     {
  44.         return $this->review;
  45.     }
  46.     public function setReview(?ShopReview $review): static
  47.     {
  48.         $this->review $review;
  49.         return $this;
  50.     }
  51.     public function isHelpful(): bool
  52.     {
  53.         return $this->isHelpful;
  54.     }
  55.     public function setIsHelpful(bool $isHelpful): static
  56.     {
  57.         $this->isHelpful $isHelpful;
  58.         return $this;
  59.     }
  60.     public function getCreatedAt(): ?\DateTimeImmutable
  61.     {
  62.         return $this->createdAt;
  63.     }
  64.     public function setCreatedAt(\DateTimeImmutable $createdAt): static
  65.     {
  66.         $this->createdAt $createdAt;
  67.         return $this;
  68.     }
  69. }