Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
CustomerLogoutObserver.php
Go to the documentation of this file.
1 <?php
7 
9 
14 {
19 
24 
29  public function __construct(
30  \Magento\Reports\Model\Product\Index\ComparedFactory $productCompFactory,
31  \Magento\Reports\Model\Product\Index\ViewedFactory $productIndxFactory
32  ) {
33  $this->_productCompFactory = $productCompFactory;
34  $this->_productIndxFactory = $productIndxFactory;
35  }
36 
44  public function execute(\Magento\Framework\Event\Observer $observer)
45  {
46  $this->_productCompFactory->create()->purgeVisitorByCustomer()->calculate();
47  $this->_productIndxFactory->create()->purgeVisitorByCustomer()->calculate();
48  }
49 }
__construct(\Magento\Reports\Model\Product\Index\ComparedFactory $productCompFactory, \Magento\Reports\Model\Product\Index\ViewedFactory $productIndxFactory)
execute(\Magento\Framework\Event\Observer $observer)