-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect caching subscription status in newsletter plugin #19345
Comments
Hi @wojtekn. Thank you for your report.
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
where @wojtekn do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?
|
Such problem is not observed when customer is saved using |
Hi @engcom-backlog-nazar. Thank you for working on this issue.
|
@engcom-backlog-nazar Thank you for verifying the issue. Based on the provided information internal tickets |
@engcom-backlog-nazar correct, I noticed from |
@orlangur we need some additional options like in productRepository force Reload = true. |
@engcom-backlog-nazar introducing such flags is really lame. It would be better if invalidation occurs somewhere inside |
@engcom-backlog-nazar I think changing getById implementation to preserve extension attributes also makes sense. It wouldn't solve my use case, but it would fix other ones. Eg. I could write plugin for subscribeCustomerById and fill extension attribute there instead of removing this variable caching in the core file patch. @orlangur it makes sense IMO. |
Hi @milindsingh. Thank you for working on this issue.
|
…gration test fix.
Hi @wojtekn. Thank you for your report.
The fix will be available with the upcoming 2.4.3 release. |
Preconditions
Steps to reproduce
I spot the issue during placing order with two different community modules installed. In short, during placing order the customer object is subscribed by custom code which utilizes newsletter module, then customer object is saved a couple times, and it results with subscribing him, unsubscribing and subscribing again.
It is a bit complicated to prepare such environment and to reproduce it so I prepared short steps which show incorrect framework behavior.
Load customer object using repository and check his subscription status:
$customer = $customerRepository->getById($customerId);
$extensionAttributes = $customer->getExtensionAttributes();
var_dump($extensionAttributes->getIsSubscribed()); // returns false
Subscribe customer to newsletter:
$subscriber = $subscriberFactory->create();
$subscriber->subscribeCustomerById($customerId);
Check subscription status again:
$customer = $customerRepository->getById($customerId);
$extensionAttributes = $customer->getExtensionAttributes();
var_dump($extensionAttributes->getIsSubscribed()); // still returns false
Expected result
Actual result
The text was updated successfully, but these errors were encountered: