/**
  * Purge visitor data by customer (logout)
  *
  * @param \Magento\Reports\Model\Product\Index\AbstractIndex $object
  * @return $this
  */
 public function purgeVisitorByCustomer(\Magento\Reports\Model\Product\Index\AbstractIndex $object)
 {
     /**
      * Do nothing if customer not logged in
      */
     if (!$object->getCustomerId()) {
         return $this;
     }
     $bind = ['visitor_id' => null];
     $where = ['customer_id = ?' => (int) $object->getCustomerId()];
     $this->_getWriteAdapter()->update($this->getMainTable(), $bind, $where);
     return $this;
 }
Example #2
0
 /**
  * @param \Magento\Framework\Model\Context $context
  * @param \Magento\Framework\Registry $registry
  * @param \Magento\Store\Model\StoreManagerInterface $storeManager
  * @param \Magento\Customer\Model\Visitor $customerVisitor
  * @param \Magento\Customer\Model\Session $customerSession
  * @param \Magento\Framework\Session\Generic $reportSession
  * @param \Magento\Catalog\Model\Product\Visibility $productVisibility
  * @param \Magento\Framework\Stdlib\DateTime $dateTime
  * @param \Magento\Catalog\Helper\Product\Compare $productCompare
  * @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource
  * @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
  * @param array $data
  * @SuppressWarnings(PHPMD.ExcessiveParameterList)
  */
 public function __construct(\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Customer\Model\Visitor $customerVisitor, \Magento\Customer\Model\Session $customerSession, \Magento\Framework\Session\Generic $reportSession, \Magento\Catalog\Model\Product\Visibility $productVisibility, \Magento\Framework\Stdlib\DateTime $dateTime, \Magento\Catalog\Helper\Product\Compare $productCompare, \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, array $data = [])
 {
     parent::__construct($context, $registry, $storeManager, $customerVisitor, $customerSession, $reportSession, $productVisibility, $dateTime, $resource, $resourceCollection, $data);
     $this->_productCompare = $productCompare;
 }