Skip to content
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

[2.3-develop][Forwardport] Transport variable can not be altered in email_invoice_set_template_vars_before Event #15039

Merged
merged 1 commit into from
May 20, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,17 @@ protected function prepareTemplate(Order $order)
'formattedShippingAddress' => $this->getFormattedShippingAddress($order),
'formattedBillingAddress' => $this->getFormattedBillingAddress($order),
];
$transport = new DataObject($transport);
$transportObject = new DataObject($transport);

/**
* Event argument `transport` is @deprecated. Use `transportObject` instead.
*/
$this->eventManager->dispatch(
'email_order_set_template_vars_before',
['sender' => $this, 'transport' => $transport]
['sender' => $this, 'transport' => $transportObject->getData(), 'transportObject' => $transportObject]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, @gwharton, due to Magento backward-compatible guide we can't rename or remove event arguments or change their type.

Adding the new arguments is allowed. If it doesn't help, you can introduce new event argument with new name or type and deprecate the old argument by adding @deprecated annotation before dispatching the event

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what has been done. $transport = $transportObject->getData() therefore the original arguments have not changed type or name. We introduce a new argument $transportObject

);

$this->templateContainer->setTemplateVars($transport->getData());
$this->templateContainer->setTemplateVars($transportObject->getData());

parent::prepareTemplate($order);
}
Expand Down