src/Entity/ProductReviews.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ProductReviewsRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassProductReviewsRepository::class)]
  8. class ProductReviews
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column(type'integer')]
  13.     private $id;
  14.     #[ORM\ManyToOne(targetEntityProducts::class, inversedBy'productReviews')]
  15.     private $product;
  16.     #[ORM\ManyToOne(targetEntityClinicUsers::class, inversedBy'productReviews')]
  17.     private $clinicUser;
  18.     #[ORM\Column(type'text')]
  19.     private $review;
  20.     #[ORM\Column(type'string'length255)]
  21.     private $clinic;
  22.     #[ORM\Column(type'integer'nullabletrue)]
  23.     private $likes;
  24.     #[ORM\Column(type'integer')]
  25.     private $rating;
  26.     #[ORM\Column(type'datetime')]
  27.     private $modified;
  28.     #[ORM\Column(type'datetime')]
  29.     private $created;
  30.     #[ORM\OneToMany(targetEntityProductReviewLikes::class, mappedBy'productReview')]
  31.     private $productReviewLikes;
  32.     #[ORM\OneToMany(targetEntityProductReviewComments::class, mappedBy'review')]
  33.     private $productReviewComments;
  34.     #[ORM\Column(type'integer'nullabletrue)]
  35.     private $isApproved;
  36.     public function __construct()
  37.     {
  38.         $this->setCreated(new \DateTime());
  39.         if ($this->getModified() == null) {
  40.             $this->setModified(new \DateTime());
  41.         }
  42.         $this->productReviewLikes = new ArrayCollection();
  43.         $this->productReviewComments = new ArrayCollection();
  44.     }
  45.     public function getId(): ?int
  46.     {
  47.         return $this->id;
  48.     }
  49.     public function getProduct(): ?Products
  50.     {
  51.         return $this->product;
  52.     }
  53.     public function setProduct(?Products $product): self
  54.     {
  55.         $this->product $product;
  56.         return $this;
  57.     }
  58.     public function getClinicUser(): ?ClinicUsers
  59.     {
  60.         return $this->clinicUser;
  61.     }
  62.     public function setClinicUser(?ClinicUsers $clinicUser): self
  63.     {
  64.         $this->clinicUser $clinicUser;
  65.         return $this;
  66.     }
  67.     public function getReview(): ?string
  68.     {
  69.         return $this->review;
  70.     }
  71.     public function setReview(string $review): self
  72.     {
  73.         $this->review $review;
  74.         return $this;
  75.     }
  76.     public function getClinic(): ?string
  77.     {
  78.         return $this->clinic;
  79.     }
  80.     public function setClinic(string $clinic): self
  81.     {
  82.         $this->clinic $clinic;
  83.         return $this;
  84.     }
  85.     public function getLikes(): ?int
  86.     {
  87.         return $this->likes;
  88.     }
  89.     public function setLikes(int $likes): self
  90.     {
  91.         $this->likes $likes;
  92.         return $this;
  93.     }
  94.     public function getRating(): ?int
  95.     {
  96.         return $this->rating;
  97.     }
  98.     public function setRating(int $rating): self
  99.     {
  100.         $this->rating $rating;
  101.         return $this;
  102.     }
  103.     public function getModified(): ?\DateTimeInterface
  104.     {
  105.         return $this->modified;
  106.     }
  107.     public function setModified(\DateTimeInterface $modified): self
  108.     {
  109.         $this->modified $modified;
  110.         return $this;
  111.     }
  112.     public function getCreated(): ?\DateTimeInterface
  113.     {
  114.         return $this->created;
  115.     }
  116.     public function setCreated(\DateTimeInterface $created): self
  117.     {
  118.         $this->created $created;
  119.         return $this;
  120.     }
  121.     /**
  122.      * @return Collection<int, ProductReviewLikes>
  123.      */
  124.     public function getProductReviewLikes(): Collection
  125.     {
  126.         return $this->productReviewLikes;
  127.     }
  128.     public function addProductReviewLike(ProductReviewLikes $productReviewLike): self
  129.     {
  130.         if (!$this->productReviewLikes->contains($productReviewLike)) {
  131.             $this->productReviewLikes[] = $productReviewLike;
  132.             $productReviewLike->setProductReview($this);
  133.         }
  134.         return $this;
  135.     }
  136.     public function removeProductReviewLike(ProductReviewLikes $productReviewLike): self
  137.     {
  138.         if ($this->productReviewLikes->removeElement($productReviewLike)) {
  139.             // set the owning side to null (unless already changed)
  140.             if ($productReviewLike->getProductReview() === $this) {
  141.                 $productReviewLike->setProductReview(null);
  142.             }
  143.         }
  144.         return $this;
  145.     }
  146.     /**
  147.      * @return Collection<int, ProductReviewComments>
  148.      */
  149.     public function getProductReviewComments(): Collection
  150.     {
  151.         return $this->productReviewComments;
  152.     }
  153.     public function addProductReviewComment(ProductReviewComments $productReviewComment): self
  154.     {
  155.         if (!$this->productReviewComments->contains($productReviewComment)) {
  156.             $this->productReviewComments[] = $productReviewComment;
  157.             $productReviewComment->setReview($this);
  158.         }
  159.         return $this;
  160.     }
  161.     public function removeProductReviewComment(ProductReviewComments $productReviewComment): self
  162.     {
  163.         if ($this->productReviewComments->removeElement($productReviewComment)) {
  164.             // set the owning side to null (unless already changed)
  165.             if ($productReviewComment->getReview() === $this) {
  166.                 $productReviewComment->setReview(null);
  167.             }
  168.         }
  169.         return $this;
  170.     }
  171.     public function getIsApproved(): ?int
  172.     {
  173.         return $this->isApproved;
  174.     }
  175.     public function setIsApproved(?int $isApproved): self
  176.     {
  177.         $this->isApproved $isApproved;
  178.         return $this;
  179.     }
  180. }