src/Flexy/ShopBundle/Entity/Product/Comment.php line 14

  1. <?php
  2. namespace App\Flexy\ShopBundle\Entity\Product;
  3. use ApiPlatform\Core\Annotation\ApiResource;
  4. use App\Flexy\ShopBundle\Entity\Customer\Customer;
  5. use App\Flexy\ShopBundle\Repository\Product\CommentRepository;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\ORM\Mapping as ORM;
  9. #[ApiResource]
  10. #[ORM\Entity(repositoryClassCommentRepository::class)]
  11. class Comment
  12. {
  13.     #[ORM\Id]
  14.     #[ORM\GeneratedValue]
  15.     #[ORM\Column(type'integer')]
  16.     private $id;
  17.     #[ORM\Column(type'datetime_immutable'nullabletrue)]
  18.     private ?\DateTimeImmutable $createdAt null;
  19.     #[ORM\Column(type'text'nullabletrue)]
  20.     private ?string $comment null;
  21.     #[ORM\ManyToOne(targetEntityCustomer::class, inversedBy'comments')]
  22.     private ?\App\Flexy\ShopBundle\Entity\Customer\Customer $customer null;
  23.     #[ORM\ManyToOne(targetEntityProduct::class, inversedBy'comments')]
  24.     private ?\App\Flexy\ShopBundle\Entity\Product\Product $product null;
  25.     #[ORM\Column(type'integer'nullabletrue)]
  26.     private ?int $rating 5;
  27.     public function __construct()
  28.     {
  29.     }
  30.     public function getId(): ?int
  31.     {
  32.         return $this->id;
  33.     }
  34.     public function getCreatedAt(): ?\DateTimeImmutable
  35.     {
  36.         return $this->createdAt;
  37.     }
  38.     public function setCreatedAt(?\DateTimeImmutable $createdAt): self
  39.     {
  40.         $this->createdAt $createdAt;
  41.         return $this;
  42.     }
  43.     public function getComment(): ?string
  44.     {
  45.         return $this->comment;
  46.     }
  47.     public function setComment(?string $comment): self
  48.     {
  49.         $this->comment $comment;
  50.         return $this;
  51.     }
  52.     public function getCustomer(): ?Customer
  53.     {
  54.         return $this->customer;
  55.     }
  56.     public function setCustomer(?Customer $customer): self
  57.     {
  58.         $this->customer $customer;
  59.         return $this;
  60.     }
  61.     public function getProduct(): ?Product
  62.     {
  63.         return $this->product;
  64.     }
  65.     public function setProduct(?Product $product): self
  66.     {
  67.         $this->product $product;
  68.         return $this;
  69.     }
  70.     public function getRating(): ?int
  71.     {
  72.         return $this->rating;
  73.     }
  74.     public function setRating(?int $rating): self
  75.     {
  76.         $this->rating $rating;
  77.         return $this;
  78.     }
  79. }