Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ReportProductSavedToNewRelic.php
Go to the documentation of this file.
1 <?php
7 
12 
17 {
21  protected $config;
22 
26  protected $newRelicWrapper;
27 
32  public function __construct(
35  ) {
36  $this->config = $config;
37  $this->newRelicWrapper = $newRelicWrapper;
38  }
39 
46  public function execute(Observer $observer)
47  {
48  if ($this->config->isNewRelicEnabled()) {
50  $product = $observer->getEvent()->getProduct();
51  if ($product->isObjectNew()) {
52  $this->newRelicWrapper->addCustomParameter(
53  \Magento\NewRelicReporting\Model\Config::PRODUCT_CHANGE,
54  'create'
55  );
56  } else {
57  $this->newRelicWrapper->addCustomParameter(
58  \Magento\NewRelicReporting\Model\Config::PRODUCT_CHANGE,
59  'update'
60  );
61  }
62  }
63  }
64 }