当前位置: 首页>>代码示例>>PHP>>正文


PHP Observer::getDataObject方法代码示例

本文整理汇总了PHP中Magento\Framework\Event\Observer::getDataObject方法的典型用法代码示例。如果您正苦于以下问题:PHP Observer::getDataObject方法的具体用法?PHP Observer::getDataObject怎么用?PHP Observer::getDataObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Framework\Event\Observer的用法示例。


在下文中一共展示了Observer::getDataObject方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 /**
  * Update transaction with HTML representation of txn_id
  *
  * @param EventObserver $observer
  * @return void
  */
 public function execute(EventObserver $observer)
 {
     /** @var \Magento\Sales\Model\Order\Payment\Transaction $transaction */
     $transaction = $observer->getDataObject();
     $order = $transaction->getOrder();
     $payment = $order->getPayment();
     $methodInstance = $payment->getMethodInstance();
     $paymentCode = $methodInstance->getCode();
     $transactionLink = $this->paypalData->getHtmlTransactionId($paymentCode, $transaction->getTxnId());
     $transaction->setData('html_txn_id', $transactionLink);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:17,代码来源:HtmlTransactionIdObserver.php

示例2: syncRemove

 /**
  * Handles synchronous removing of the entity from
  * corresponding grid on certain events.
  *
  * Used in the next events:
  *
  *  - sales_order_delete_after
  *  - sales_order_invoice_delete_after
  *  - sales_order_shipment_delete_after
  *  - sales_order_creditmemo_delete_after
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return void
  */
 public function syncRemove(\Magento\Framework\Event\Observer $observer)
 {
     $this->entityGrid->purge($observer->getDataObject()->getId());
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:18,代码来源:IndexGrid.php

示例3: saveChangeTime

 /**
  * Save time stamp of last change
  *
  * @param EventObserver $event
  * @return void
  */
 public function saveChangeTime($event)
 {
     /** @var $theme \Magento\Theme\Model\Theme|null */
     $theme = $event->getTheme() ?: $event->getDataObject()->getTheme();
     /** @var $change \Magento\DesignEditor\Model\Theme\Change */
     $change = $this->objectManager->create('Magento\\DesignEditor\\Model\\Theme\\Change');
     if ($theme && $theme->getId()) {
         $change->loadByThemeId($theme->getId());
         $change->setThemeId($theme->getId())->setChangeTime(null);
         $change->save();
     }
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:18,代码来源:Observer.php


注:本文中的Magento\Framework\Event\Observer::getDataObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。