CustomFieldEntity.php
2 months ago
DynamicSegmentFilterData.php
2 months ago
DynamicSegmentFilterEntity.php
3 years ago
FeatureFlagEntity.php
3 years ago
FormEntity.php
1 week ago
LogEntity.php
3 years ago
NewsletterEntity.php
2 months ago
NewsletterLinkEntity.php
3 years ago
NewsletterOptionEntity.php
3 years ago
NewsletterOptionFieldEntity.php
1 month ago
NewsletterPostEntity.php
3 years ago
NewsletterSegmentEntity.php
3 years ago
NewsletterTemplateEntity.php
3 years ago
ScheduledTaskEntity.php
1 month ago
ScheduledTaskSubscriberEntity.php
1 year ago
SegmentEntity.php
2 months ago
SendingQueueEntity.php
2 months ago
SettingEntity.php
3 years ago
StatisticsBounceEntity.php
3 years ago
StatisticsClickEntity.php
3 years ago
StatisticsFormEntity.php
3 years ago
StatisticsNewsletterEntity.php
1 year ago
StatisticsOpenEntity.php
3 years ago
StatisticsUnsubscribeEntity.php
2 months ago
StatisticsWooCommercePurchaseEntity.php
2 years ago
StatsNotificationEntity.php
3 years ago
SubscriberCustomFieldEntity.php
3 years ago
SubscriberEntity.php
4 days ago
SubscriberIPEntity.php
3 years ago
SubscriberSegmentEntity.php
3 years ago
SubscriberTagEntity.php
4 years ago
TagEntity.php
3 years ago
UserAgentEntity.php
3 years ago
UserFlagEntity.php
3 years ago
WpPostEntity.php
2 years ago
index.php
3 years ago
SubscriberIPEntity.php
51 lines
| 1 | <?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing |
| 2 | |
| 3 | namespace MailPoet\Entities; |
| 4 | |
| 5 | if (!defined('ABSPATH')) exit; |
| 6 | |
| 7 | |
| 8 | use DateTimeInterface; |
| 9 | use MailPoetVendor\Carbon\Carbon; |
| 10 | use MailPoetVendor\Doctrine\ORM\Mapping as ORM; |
| 11 | |
| 12 | /** |
| 13 | * @ORM\Entity() |
| 14 | * @ORM\Table(name="subscriber_ips") |
| 15 | */ |
| 16 | class SubscriberIPEntity { |
| 17 | /** |
| 18 | * @ORM\Id |
| 19 | * @ORM\Column(type="string") |
| 20 | * @var string |
| 21 | */ |
| 22 | private $ip; |
| 23 | |
| 24 | /** |
| 25 | * We have to use own type because createdAt is part of the primary key and basic datetimetz isn't supported in primary key |
| 26 | * @ORM\Id |
| 27 | * @ORM\Column(type="datetimetz_to_string") |
| 28 | * @var DateTimeInterface |
| 29 | */ |
| 30 | private $createdAt; |
| 31 | |
| 32 | public function __construct( |
| 33 | string $ip |
| 34 | ) { |
| 35 | $this->ip = $ip; |
| 36 | $this->createdAt = new Carbon(); |
| 37 | } |
| 38 | |
| 39 | public function getIP(): string { |
| 40 | return $this->ip; |
| 41 | } |
| 42 | |
| 43 | public function getCreatedAt(): DateTimeInterface { |
| 44 | return $this->createdAt; |
| 45 | } |
| 46 | |
| 47 | public function setCreatedAt(DateTimeInterface $createdAt): void { |
| 48 | $this->createdAt = $createdAt; |
| 49 | } |
| 50 | } |
| 51 |