Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Stock.php
Go to the documentation of this file.
1 <?php
7 
9 
34 {
39 
48  public function __construct(
49  \Magento\Framework\Model\Context $context,
50  \Magento\Framework\Registry $registry,
51  \Magento\ProductAlert\Model\ResourceModel\Stock\Customer\CollectionFactory $customerColFactory,
52  \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
53  \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
54  array $data = []
55  ) {
56  $this->_customerColFactory = $customerColFactory;
57  parent::__construct($context, $registry, $resource, $resourceCollection, $data);
58  }
59 
63  protected function _construct()
64  {
65  $this->_init(\Magento\ProductAlert\Model\ResourceModel\Stock::class);
66  }
67 
71  public function getCustomerCollection()
72  {
73  return $this->_customerColFactory->create();
74  }
75 
79  public function loadByParam()
80  {
81  if ($this->getProductId() !== null && $this->getCustomerId() !== null && $this->getWebsiteId() !== null) {
82  $this->getResource()->loadByParam($this);
83  }
84  return $this;
85  }
86 
92  public function deleteCustomer($customerId, $websiteId = 0)
93  {
94  $this->getResource()->deleteCustomer($this, $customerId, $websiteId);
95  return $this;
96  }
97 }
$resource
Definition: bulk.php:12
__construct(\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\ProductAlert\Model\ResourceModel\Stock\Customer\CollectionFactory $customerColFactory, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[])
Definition: Stock.php:48
deleteCustomer($customerId, $websiteId=0)
Definition: Stock.php:92