Flush database changes before invoking "mailpoet_segment_subscribed" hook
This is to ensure the hook consumers can read up-to-date data from the database. [MAILPOET-4946]
This commit is contained in:
@ -111,6 +111,7 @@ class SubscriberSegmentRepository extends Repository {
|
||||
$subscriber->getSubscriberSegments()->add($subscriberSegment);
|
||||
$this->entityManager->persist($subscriberSegment);
|
||||
}
|
||||
$this->entityManager->flush();
|
||||
|
||||
// fire subscribed hook for new subscriptions
|
||||
if (
|
||||
@ -122,7 +123,6 @@ class SubscriberSegmentRepository extends Repository {
|
||||
$this->wp->doAction('mailpoet_segment_subscribed', $subscriberSegment);
|
||||
}
|
||||
|
||||
$this->entityManager->flush();
|
||||
return $subscriberSegment;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user