Add getValue method to Field
[MAILPOET-4191]
This commit is contained in:
committed by
Veljko V
parent
69b523171f
commit
b2f2f2665c
@@ -54,6 +54,11 @@ class Field {
|
|||||||
return $this->factory;
|
return $this->factory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @phpstan-ignore-next-line - there is no consistent return type
|
||||||
|
public function getValue() {
|
||||||
|
return $this->getFactory()();
|
||||||
|
}
|
||||||
|
|
||||||
public function getArgs(): array {
|
public function getArgs(): array {
|
||||||
return $this->args;
|
return $this->args;
|
||||||
}
|
}
|
||||||
|
@@ -61,14 +61,14 @@ class SendWelcomeEmailAction implements Action {
|
|||||||
throw InvalidStateException::create()->withMessage(__('No mailpoet:segment subject provided.', 'mailpoet'));
|
throw InvalidStateException::create()->withMessage(__('No mailpoet:segment subject provided.', 'mailpoet'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$globalSubscriberStatus = $subscriberSubject->getSubscriberStatusField()->getFactory()();
|
$globalSubscriberStatus = $subscriberSubject->getSubscriberStatusField()->getValue();
|
||||||
if ($globalSubscriberStatus !== SubscriberEntity::STATUS_SUBSCRIBED) {
|
if ($globalSubscriberStatus !== SubscriberEntity::STATUS_SUBSCRIBED) {
|
||||||
throw InvalidStateException::create()->withMessage(__(sprintf("Cannot send a welcome email to a subscriber with a global subscription status of '%s'.", $globalSubscriberStatus), 'mailpoet'));
|
throw InvalidStateException::create()->withMessage(__(sprintf("Cannot send a welcome email to a subscriber with a global subscription status of '%s'.", $globalSubscriberStatus), 'mailpoet'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$segmentName = $segmentSubject->getNameField()->getFactory()();
|
$segmentName = $segmentSubject->getNameField()->getValue();
|
||||||
$idField = $subscriberSubject->getSubscriberIdField();
|
$idField = $subscriberSubject->getSubscriberIdField();
|
||||||
$subscriberId = $idField->getFactory()();
|
$subscriberId = $idField->getValue();
|
||||||
if ($subscriberId === null) {
|
if ($subscriberId === null) {
|
||||||
throw NotFoundException::create()->withMessage(__(sprintf("Subscriber with ID '%s' not found.", $subscriberId), 'mailpoet'));
|
throw NotFoundException::create()->withMessage(__(sprintf("Subscriber with ID '%s' not found.", $subscriberId), 'mailpoet'));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user