Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Compare.php
Go to the documentation of this file.
1 <?php
7 
11 
19 {
25  protected $_customerId = null;
26 
32  protected $_catalogSession;
33 
40 
46  protected $_customerVisitor;
47 
53  protected $_customerSession;
54 
61 
68 
72  protected $_storeManager;
73 
77  protected $_formKeyValidator;
78 
82  protected $resultPageFactory;
83 
87  protected $productRepository;
88 
105  public function __construct(
106  \Magento\Framework\App\Action\Context $context,
107  \Magento\Catalog\Model\Product\Compare\ItemFactory $compareItemFactory,
108  \Magento\Catalog\Model\ResourceModel\Product\Compare\Item\CollectionFactory $itemCollectionFactory,
109  \Magento\Customer\Model\Session $customerSession,
110  \Magento\Customer\Model\Visitor $customerVisitor,
111  \Magento\Catalog\Model\Product\Compare\ListCompare $catalogProductCompareList,
112  \Magento\Catalog\Model\Session $catalogSession,
113  \Magento\Store\Model\StoreManagerInterface $storeManager,
114  Validator $formKeyValidator,
117  ) {
118  $this->_storeManager = $storeManager;
119  $this->_compareItemFactory = $compareItemFactory;
120  $this->_itemCollectionFactory = $itemCollectionFactory;
121  $this->_customerSession = $customerSession;
122  $this->_customerVisitor = $customerVisitor;
123  $this->_catalogProductCompareList = $catalogProductCompareList;
124  $this->_catalogSession = $catalogSession;
125  $this->_formKeyValidator = $formKeyValidator;
126  $this->resultPageFactory = $resultPageFactory;
127  $this->productRepository = $productRepository;
128  parent::__construct($context);
129  }
130 
137  public function setCustomerId($customerId)
138  {
139  $this->_customerId = $customerId;
140  return $this;
141  }
142 }
$storeManager
__construct(\Magento\Framework\App\Action\Context $context, \Magento\Catalog\Model\Product\Compare\ItemFactory $compareItemFactory, \Magento\Catalog\Model\ResourceModel\Product\Compare\Item\CollectionFactory $itemCollectionFactory, \Magento\Customer\Model\Session $customerSession, \Magento\Customer\Model\Visitor $customerVisitor, \Magento\Catalog\Model\Product\Compare\ListCompare $catalogProductCompareList, \Magento\Catalog\Model\Session $catalogSession, \Magento\Store\Model\StoreManagerInterface $storeManager, Validator $formKeyValidator, PageFactory $resultPageFactory, ProductRepositoryInterface $productRepository)
Definition: Compare.php:105