*/ class Price extends \Magento\Framework\Model\AbstractModel { /** * @var \Magento\ProductAlert\Model\ResourceModel\Price\Customer\CollectionFactory */ protected $_customerColFactory; /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry * @param \Magento\ProductAlert\Model\ResourceModel\Price\Customer\CollectionFactory $customerColFactory * @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource * @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection * @param array $data */ public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\ProductAlert\Model\ResourceModel\Price\Customer\CollectionFactory $customerColFactory, \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, array $data = [] ) { $this->_customerColFactory = $customerColFactory; parent::__construct($context, $registry, $resource, $resourceCollection, $data); } /** * @return void */ protected function _construct() { $this->_init('Magento\ProductAlert\Model\ResourceModel\Price'); } /** * @return Collection */ public function getCustomerCollection() { return $this->_customerColFactory->create(); } /** * @return $this */ public function loadByParam() { if ($this->getProductId() !== null && $this->getCustomerId() !== null && $this->getWebsiteId() !== null) { $this->getResource()->loadByParam($this); } return $this; } /** * @param int $customerId * @param int $websiteId * @return $this */ public function deleteCustomer($customerId, $websiteId = 0) { $this->getResource()->deleteCustomer($this, $customerId, $websiteId); return $this; } }