src/JanusHercules/ScamCountermeasures/Domain/Entity/ArchivedUser.php line 13

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