Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Email.php
Go to the documentation of this file.
1 <?php
7 
9 {
15  const ADMIN_RESOURCE = 'Magento_Sales::email';
16 
22  public function execute()
23  {
24  $order = $this->_initOrder();
25  if ($order) {
26  try {
27  $this->orderManagement->notify($order->getEntityId());
28  $this->messageManager->addSuccessMessage(__('You sent the order email.'));
29  } catch (\Magento\Framework\Exception\LocalizedException $e) {
30  $this->messageManager->addErrorMessage($e->getMessage());
31  } catch (\Exception $e) {
32  $this->messageManager->addErrorMessage(__('We can\'t send the email order right now.'));
33  $this->logger->critical($e);
34  }
35  return $this->resultRedirectFactory->create()->setPath(
36  'sales/order/view',
37  [
38  'order_id' => $order->getEntityId()
39  ]
40  );
41  }
42  return $this->resultRedirectFactory->create()->setPath('sales/*/');
43  }
44 }
$order
Definition: order.php:55
__()
Definition: __.php:13