6
6
7
7
namespace Magento \CatalogRule \Cron ;
8
8
9
- use Magento \CatalogRule \Model \Indexer \PartialIndex ;
10
9
use Magento \CatalogRule \Model \Indexer \Rule \RuleProductProcessor ;
10
+ use Magento \CatalogRule \Model \ResourceModel \Rule \CollectionFactory as RuleCollectionFactory ;
11
11
12
12
/**
13
13
* Daily update catalog price rule by cron
@@ -20,24 +20,25 @@ class DailyCatalogUpdate
20
20
protected $ ruleProductProcessor ;
21
21
22
22
/**
23
- * @var PartialIndex
23
+ * @var RuleCollectionFactory
24
24
*/
25
- private $ partialIndex ;
25
+ private $ ruleCollectionFactory ;
26
26
27
27
/**
28
28
* @param RuleProductProcessor $ruleProductProcessor
29
- * @param PartialIndex $partialIndex
29
+ * @param RuleCollectionFactory $ruleCollectionFactory
30
30
*/
31
31
public function __construct (
32
32
RuleProductProcessor $ ruleProductProcessor ,
33
- PartialIndex $ partialIndex
33
+ RuleCollectionFactory $ ruleCollectionFactory
34
34
) {
35
35
$ this ->ruleProductProcessor = $ ruleProductProcessor ;
36
- $ this ->partialIndex = $ partialIndex ;
36
+ $ this ->ruleCollectionFactory = $ ruleCollectionFactory ;
37
37
}
38
38
39
39
/**
40
40
* Daily update catalog price rule by cron
41
+ *
41
42
* Update include interval 3 days - current day - 1 days before + 1 days after
42
43
* This method is called from cron process, cron is working in UTC time and
43
44
* we should generate data for interval -1 day ... +1 day
@@ -46,8 +47,10 @@ public function __construct(
46
47
*/
47
48
public function execute ()
48
49
{
49
- $ this ->ruleProductProcessor ->isIndexerScheduled ()
50
- ? $ this ->partialIndex ->partialUpdateCatalogRuleProductPrice ()
51
- : $ this ->ruleProductProcessor ->markIndexerAsInvalid ();
50
+ $ ruleCollection = $ this ->ruleCollectionFactory ->create ();
51
+ $ ruleCollection ->addIsActiveFilter ();
52
+ if ($ ruleCollection ->getSize ()) {
53
+ $ this ->ruleProductProcessor ->markIndexerAsInvalid ();
54
+ }
52
55
}
53
56
}
0 commit comments