CreateProductReviewInput.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. namespace Webkul\BagistoApi\Dto;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use Symfony\Component\Serializer\Annotation\Groups;
  5. /**
  6. * DTO for creating product reviews via GraphQL mutation
  7. * This explicitly defines all input fields for the GraphQL schema
  8. */
  9. #[ApiResource]
  10. class CreateProductReviewInput
  11. {
  12. #[Groups(['mutation'])]
  13. public int $productId;
  14. #[Groups(['mutation'])]
  15. public string $title;
  16. #[Groups(['mutation'])]
  17. public string $comment;
  18. #[Groups(['mutation'])]
  19. public int $rating;
  20. #[Groups(['mutation'])]
  21. public string $name;
  22. #[Groups(['mutation'])]
  23. public ?string $email = null;
  24. #[Groups(['mutation'])]
  25. public ?int $status = null;
  26. #[Groups(['mutation'])]
  27. public ?string $attachments;
  28. public function __construct(
  29. int $productId,
  30. string $title,
  31. string $comment,
  32. int $rating,
  33. string $name,
  34. ?string $email = null,
  35. ?int $status = null,
  36. ?string $attachments = '',
  37. ) {
  38. $this->productId = $productId;
  39. $this->title = $title;
  40. $this->comment = $comment;
  41. $this->rating = $rating;
  42. $this->name = $name;
  43. $this->email = $email;
  44. $this->status = $status;
  45. $this->attachments = $attachments;
  46. }
  47. }