src/App/Entity/CleverpushSubscription.php line 22

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Utility\GuidUtility;
  4. use DateTime;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8. * @ORM\Entity()
  9. *
  10. * @ORM\Table(
  11. * name="cleverpush_subscriptions",
  12. * indexes={
  13. *
  14. * @ORM\Index(name="subscription_id_idx", columns={"subscription_id"}),
  15. * @ORM\Index(name="users_id_idx", columns={"users_id"})
  16. * }
  17. * )
  18. */
  19. class CleverpushSubscription
  20. {
  21. public function __construct()
  22. {
  23. $this->users = new ArrayCollection();
  24. }
  25. /**
  26. * @var string
  27. *
  28. * @ORM\GeneratedValue(strategy="CUSTOM")
  29. *
  30. * @ORM\CustomIdGenerator(class="App\Utility\DatabaseIdGenerator")
  31. *
  32. * @ORM\Column(name="id", type="guid")
  33. *
  34. * @ORM\Id
  35. */
  36. private $id;
  37. public function getId(): string
  38. {
  39. return $this->id;
  40. }
  41. public function setId(string $id): void
  42. {
  43. GuidUtility::validOrThrow($id);
  44. $this->id = $id;
  45. }
  46. /**
  47. * @var User
  48. *
  49. * @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="cleverpushSubscriptions", cascade={"persist"})
  50. *
  51. * @ORM\JoinColumn(name="users_id", referencedColumnName="id", nullable=false, onDelete="CASCADE")
  52. */
  53. protected $user;
  54. public function setUser(User $user): void
  55. {
  56. $this->user = $user;
  57. }
  58. public function getUser(): User
  59. {
  60. return $this->user;
  61. }
  62. /**
  63. * @var string
  64. *
  65. * @ORM\Column(name="subscription_id", type="string", length=30, nullable=true)
  66. */
  67. private $subscriptionId;
  68. public function getSubscriptionId(): ?string
  69. {
  70. return $this->subscriptionId;
  71. }
  72. public function setSubscriptionId(?string $subscriptionId): void
  73. {
  74. $this->subscriptionId = $subscriptionId;
  75. }
  76. /**
  77. * @var DateTime
  78. *
  79. * @ORM\Column(name="subscribed_at", type="datetime", nullable=true)
  80. */
  81. private $subscribedAt;
  82. public function getSubscribedAt(): ?DateTime
  83. {
  84. return $this->subscribedAt;
  85. }
  86. public function setSubscribedAt(?DateTime $subscribedAt): void
  87. {
  88. $this->subscribedAt = $subscribedAt;
  89. }
  90. }