-
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
11740: Sending emails from Admin in Multi-Store Environment defaults to Primary Store #11992
Conversation
* @param string|int $store | ||
* @return $this | ||
*/ | ||
public function setFromByStore($from, $store) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not encouraged to add new public methods in classes marked as api
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ishakhsuvarov, fixed. I created separate class. Notify me if you accept these changes, i'll squash commits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a hack. Surely the correct decision should have been to mark the old setFrom function as deprecated and introduce a new working function, setFromByStore in the API.
The resulting fix that was implemented was not good, involving making objects static that shouldnt have been static, to allow other classes access its protected members. This is far worse in my opinion and has already lead to two further issues being raised caused by this commit. Can this not be looked at again and fixed properly instead of the hack that is currently in place to avoid changing the transportBuilder class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like solution may be simplified
* | ||
* @return $this | ||
*/ | ||
public function setFromByStore($from, $store) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any reason to introduce another class and method instead of just adding an optional parameter scopeId
to \Magento\Framework\Mail\Template\TransportBuilder::setFrom
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ishakhsuvarov, is it allowed? According to the backward compatibility(http://devdocs.magento.com/guides/v2.2/contributor-guide/backward-compatible-development/index.html) seems it is prohibited.
May I add optional parameter scopeId?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct. I overlooked that for this case
…nment defaults to Primary Store #11992
[EngCom] Public Pull Requests - 2.2-develop - MAGETWO-83552: save invoice ID on credit memo when using API method salesRefundInvoiceV1 #11670 - MAGETWO-82577: [Backport 2.2] Translate order getCreatedAtFormatted() to store locale #11422 - MAGETWO-84474: 10128: New Orders not being saved to order grid #12241 - MAGETWO-83783: Shipping method fixtures not compatible with getShippingMethod(true) in OrderCreateTest #12227 - MAGETWO-83290: Add swatch option: Prevent loosing data and default value if data is not populated via adminhtml #12036 - MAGETWO-83741: 11740: Sending emails from Admin in Multi-Store Environment defaults to Primary Store #11992 - MAGETWO-83399: Fix for remove 'product_list_toolbar' block from layout in XML #9413 #11473
@RomaKis This commit breaks situations where Magento sends multiple emails at the same time. Just before senderBuilder sends the email it calls transportBuilder->getTransport() which resets the email ready for the next one. This includes instantiating a new $message object. From this point onwards the $message object is no longer statically shared with transportBuilderByStore. On sending the second, and subsequent emails, the function fails becasuse although transportBuilder has a nice new fresh $message object to work on, transportBuilderByStore does not. |
Description
Sending emails from Admin in Multi-Store Environment defaults to Primary Store
Fixed Issues (if relevant)
Manual testing scenarios
Contribution checklist