src/Entity/ErrorReportSubmission.php line 32

  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM,
  4.     Doctrine\DBAL\Types\Types;
  5. use Symfony\Component\Serializer\Annotation\Groups,
  6.     Symfony\Component\Validator\Constraints as Assert;
  7. use ApiPlatform\Metadata\ApiResource,
  8.     ApiPlatform\Metadata\ApiProperty,
  9.     ApiPlatform\Metadata\Get,
  10.     ApiPlatform\Metadata\GetCollection;
  11. use App\Entity\Trait\IdTrait,
  12.     App\Entity\Trait\UuidTrait,
  13.     App\Entity\Trait\TimestampableTrait,
  14.     App\Repository\ErrorReportSubmissionRepository;
  15. #[ApiResource(
  16.     description'Error report submissions',
  17.     normalizationContext: ['groups' => ['read''read:' self::class]],
  18.     security'is_granted("' self::class . '")',
  19.     order: ['createdAt' => 'desc'],
  20.     operations: [
  21.         new GetCollection(),
  22.         new Get(),
  23.     ],
  24.     extraProperties: ['standard_put' => false],
  25. )]
  26. #[ORM\Entity(repositoryClassErrorReportSubmissionRepository::class)]
  27. class ErrorReportSubmission
  28. {
  29.     use IdTrait,
  30.         UuidTrait,
  31.         TimestampableTrait;
  32.     #[ApiProperty(description'Full name')]
  33.     #[Groups(['read:' self::class])]
  34.     #[Assert\NotBlank]
  35.     #[ORM\Column(typeTypes::STRINGlength511)]
  36.     private string $fullName;
  37.     #[ApiProperty(description'E-mail')]
  38.     #[Groups(['read:' self::class])]
  39.     #[Assert\NotBlank]
  40.     #[Assert\Email]
  41.     #[ORM\Column(typeTypes::STRINGlength255)]
  42.     private string $email;
  43.     #[ApiProperty(description'Description')]
  44.     #[Groups(['read:' self::class])]
  45.     #[Assert\NotBlank]
  46.     #[ORM\Column(typeTypes::TEXT)]
  47.     private string $description;
  48.     public function __construct()
  49.     {
  50.         $this->setUuid();
  51.         $this->createdAt = new \DateTimeImmutable();
  52.         $this->updatedAt = new \DateTimeImmutable();
  53.     }
  54.     public function getFullName(): string
  55.     {
  56.         return $this->fullName;
  57.     }
  58.     public function setFullName(string $fullName): self
  59.     {
  60.         $this->fullName $fullName;
  61.         return $this;
  62.     }
  63.     public function getEmail(): string
  64.     {
  65.         return $this->email;
  66.     }
  67.     public function setEmail(string $email): self
  68.     {
  69.         $this->email $email;
  70.         return $this;
  71.     }
  72.     public function getDescription(): string
  73.     {
  74.         return $this->description;
  75.     }
  76.     public function setDescription(string $description): self
  77.     {
  78.         $this->description $description;
  79.         return $this;
  80.     }
  81. }