src/JanusHercules/ExternallyIncomingApplications/Domain/Entity/PerspectiveRequest.php line 14

Open in your IDE?
  1. <?php
  2. namespace JanusHercules\ExternallyIncomingApplications\Domain\Entity;
  3. use App\Utility\DatabaseIdGenerator;
  4. use App\Utility\DateTimeUtility;
  5. use DateTime;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Exception;
  9. #[ORM\Entity]
  10. #[ORM\Table(name: 'perspective_requests')]
  11. class PerspectiveRequest
  12. {
  13. /**
  14. * @throws Exception
  15. */
  16. public function __construct(
  17. string $requestData
  18. ) {
  19. $this->createdAt = DateTimeUtility::createDateTimeCet();
  20. $this->requestData = $requestData;
  21. }
  22. #[ORM\Id]
  23. #[ORM\GeneratedValue(strategy: 'CUSTOM')]
  24. #[ORM\CustomIdGenerator(class: DatabaseIdGenerator::class)]
  25. #[ORM\Column(
  26. type : Types::GUID,
  27. unique: true
  28. )]
  29. private ?string $id = null;
  30. public function getId(): ?string
  31. {
  32. return $this->id;
  33. }
  34. #[ORM\Column(
  35. type : Types::DATETIME_MUTABLE,
  36. nullable: false
  37. )]
  38. private DateTime $createdAt;
  39. public function setCreatedAt(DateTime $createdAt): void
  40. {
  41. $this->createdAt = $createdAt;
  42. }
  43. public function getCreatedAt(): DateTime
  44. {
  45. return $this->createdAt;
  46. }
  47. #[ORM\Column(
  48. type : Types::TEXT,
  49. length : 32768,
  50. nullable: false
  51. )]
  52. private string $requestData;
  53. public function setRequestData(string $requestData): void
  54. {
  55. $this->requestData = mb_substr($requestData, 0, 32768);
  56. }
  57. public function getRequestData(): string
  58. {
  59. return $this->requestData;
  60. }
  61. }