Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AfterAddressSaveObserver.php
Go to the documentation of this file.
1 <?php
7 
15 
17 {
21  protected $taxHelper;
22 
28  private $moduleManager;
29 
35  private $cacheConfig;
36 
42  private $addressManager;
43 
50  public function __construct(
52  Manager $moduleManager,
53  Config $cacheConfig,
54  TaxAddressManagerInterface $addressManager
55  ) {
56  $this->taxHelper = $taxHelper;
57  $this->moduleManager = $moduleManager;
58  $this->cacheConfig = $cacheConfig;
59  $this->addressManager = $addressManager;
60  }
61 
67  public function execute(Observer $observer)
68  {
69  if ($this->moduleManager->isEnabled('Magento_PageCache')
70  && $this->cacheConfig->isEnabled()
71  && $this->taxHelper->isCatalogPriceDisplayAffectedByTax()
72  ) {
74  $address = $observer->getCustomerAddress();
75  $this->addressManager->setDefaultAddressAfterSave($address);
76  }
77  }
78 }
__construct(Data $taxHelper, Manager $moduleManager, Config $cacheConfig, TaxAddressManagerInterface $addressManager)
$address
Definition: customer.php:38
$moduleManager
Definition: products.php:75