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
SettingEntity.php
61 lines
| 1 | <?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing |
| 2 | |
| 3 | namespace MailPoet\Entities; |
| 4 | |
| 5 | if (!defined('ABSPATH')) exit; |
| 6 | |
| 7 | |
| 8 | use MailPoet\Doctrine\EntityTraits\AutoincrementedIdTrait; |
| 9 | use MailPoet\Doctrine\EntityTraits\CreatedAtTrait; |
| 10 | use MailPoet\Doctrine\EntityTraits\UpdatedAtTrait; |
| 11 | use MailPoet\Util\Helpers; |
| 12 | use MailPoetVendor\Doctrine\ORM\Mapping as ORM; |
| 13 | use MailPoetVendor\Symfony\Component\Validator\Constraints as Assert; |
| 14 | |
| 15 | /** |
| 16 | * @ORM\Entity() |
| 17 | * @ORM\Table(name="settings") |
| 18 | */ |
| 19 | class SettingEntity { |
| 20 | use AutoincrementedIdTrait; |
| 21 | use CreatedAtTrait; |
| 22 | use UpdatedAtTrait; |
| 23 | |
| 24 | /** |
| 25 | * @ORM\Column(type="string") |
| 26 | * @Assert\NotBlank() |
| 27 | * @var string |
| 28 | */ |
| 29 | private $name; |
| 30 | |
| 31 | /** |
| 32 | * @ORM\Column(type="text", nullable=true) |
| 33 | * @var string|null |
| 34 | */ |
| 35 | private $value; |
| 36 | |
| 37 | /** @return string */ |
| 38 | public function getName() { |
| 39 | return $this->name; |
| 40 | } |
| 41 | |
| 42 | /** @param string $name */ |
| 43 | public function setName($name) { |
| 44 | $this->name = $name; |
| 45 | } |
| 46 | |
| 47 | /** @return mixed */ |
| 48 | public function getValue() { |
| 49 | return $this->value !== null && is_serialized($this->value) ? unserialize($this->value) : $this->value; |
| 50 | } |
| 51 | |
| 52 | /** @param mixed $value */ |
| 53 | public function setValue($value) { |
| 54 | $value = Helpers::recursiveTrim($value); |
| 55 | if (is_array($value)) { |
| 56 | $value = serialize($value); |
| 57 | } |
| 58 | $this->value = $value; |
| 59 | } |
| 60 | } |
| 61 |