src/Entity/Comments.php line 12
<?phpnamespace App\Entity;use ApiPlatform\Metadata\ApiResource;use App\Repository\CommentsRepository;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;use ApiPlatform\Metadata\ApiFilter;use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;use Symfony\Component\Serializer\Annotation\Groups;#[ORM\Entity(repositoryClass: CommentsRepository::class)]#[ApiResource(normalizationContext: ['groups' => ['comment:read']],denormalizationContext: ['groups' => ['comment:write']],)]#[ApiFilter(SearchFilter::class, properties: ['product.id' => 'exact','show' => 'exact',])]class Comments{#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]#[Groups(['comment:read', 'comment:write', 'product:read'])]private ?int $id = null;#[Groups(['comment:read', 'comment:write', 'product:read'])]#[ORM\ManyToOne(inversedBy: 'comments')]private ?Products $product = null;#[Groups(['comment:read', 'comment:write', 'product:read'])]#[ORM\ManyToOne(inversedBy: 'comments')]private ?User $users = null;#[Groups(['comment:read', 'comment:write', 'product:read'])]#[ORM\Column(type: Types::TEXT)]private ?string $content = null;#[Groups(['comment:read', 'comment:write'])]#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]private ?\DateTimeInterface $date = null;#[Groups(['comment:read', 'comment:write'])]#[ORM\Column(nullable: true)]private ?bool $show = null;public function getId(): ?int{return $this->id;}public function getProduct(): ?Products{return $this->product;}public function setProduct(?Products $product): static{$this->product = $product;return $this;}public function getUsers(): ?User{return $this->users;}public function setUsers(?User $users): static{$this->users = $users;return $this;}public function getContent(): ?string{return $this->content;}public function setContent(string $content): static{$this->content = $content;return $this;}public function getDate(): ?\DateTimeInterface{return $this->date;}public function setDate(?\DateTimeInterface $date): static{$this->date = $date;return $this;}public function isShow(): ?bool{return $this->show;}public function setShow(?bool $show): static{$this->show = $show;return $this;}}