100 \
Magento\Catalog\Model\
Product\ConditionFactory $conditionFactory,
103 \
Magento\Framework\Event\ManagerInterface $eventManager,
111 $this->_conditionFactory = $conditionFactory;
112 $this->_coreDate = $coreDate;
114 $this->_eventManager = $eventManager;
115 $this->_catalogRuleData = $catalogRuleData;
119 $this->_associatedEntitiesMap = $this->getAssociatedEntitiesMap();
131 $this->
_init(
'catalogrule',
'rule_id');
142 $this->
getTable(
'catalogrule_product'),
143 [
'rule_id=?' => $rule->getId()]
146 $this->
getTable(
'catalogrule_group_website'),
147 [
'rule_id=?' => $rule->getId()]
149 return parent::_afterDelete(
$rule);
165 if (isset(
$data[$pId])) {
186 ->from($this->
getTable(
'catalogrule_product_price'), [
'product_id',
'rule_price'])
187 ->where(
'rule_date = ?', $date->format(
'Y-m-d'))
189 ->where(
'customer_group_id = ?', $customerGroupId)
207 if (is_string($date)) {
208 $date = strtotime($date);
211 ->from($this->
getTable(
'catalogrule_product'))
213 ->where(
'customer_group_id = ?', $customerGroupId)
215 ->where(
'from_time = 0 or from_time < ?', $date)
216 ->where(
'to_time = 0 or to_time > ?', $date);
230 $this->getEntityManager()->load($object,
$value);
241 $this->getEntityManager()->save($object);
254 $this->getEntityManager()->delete($object);
262 private function getAssociatedEntitiesMap()
264 if (!$this->_associatedEntitiesMap) {
276 private function getEntityManager()
278 if (
null === $this->entityManager) {
280 ->get(\
Magento\Framework\EntityManager\EntityManager::class);
_afterDelete(\Magento\Framework\Model\AbstractModel $rule)
load(\Magento\Framework\Model\AbstractModel $object, $value, $field=null)
_init($mainTable, $idFieldName)
__construct(\Magento\Framework\Model\ResourceModel\Db\Context $context, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Product\ConditionFactory $conditionFactory, \Magento\Framework\Stdlib\DateTime\DateTime $coreDate, \Magento\Eav\Model\Config $eavConfig, \Magento\Framework\Event\ManagerInterface $eventManager, \Magento\CatalogRule\Helper\Data $catalogRuleData, \Psr\Log\LoggerInterface $logger, \Magento\Framework\Stdlib\DateTime $dateTime, PriceCurrencyInterface $priceCurrency, $connectionName=null)
getRulesFromProduct($date, $websiteId, $customerGroupId, $productId)
save(\Magento\Framework\Model\AbstractModel $object)
getRulePrices(\DateTimeInterface $date, $websiteId, $customerGroupId, $productIds)
getRulePrice($date, $wId, $gId, $pId)