Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AggregateSalesReportCouponsData.php
Go to the documentation of this file.
1 <?php
7 
9 {
13  protected $_reportRule;
14 
18  protected $_localeResolver;
19 
23  protected $_localeDate;
24 
30  public function __construct(
31  \Magento\SalesRule\Model\ResourceModel\Report\Rule $reportRule,
32  \Magento\Framework\Locale\ResolverInterface $localeResolver,
33  \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate
34  ) {
35  $this->_reportRule = $reportRule;
36  $this->_localeResolver = $localeResolver;
37  $this->_localeDate = $localeDate;
38  }
39 
45  public function execute()
46  {
47  $this->_localeResolver->emulate(0);
48  $currentDate = $this->_localeDate->date();
49  $date = $currentDate->modify('-25 hours');
50  $this->_reportRule->aggregate($date);
51  $this->_localeResolver->revert();
52 
53  return $this;
54  }
55 }
__construct(\Magento\SalesRule\Model\ResourceModel\Report\Rule $reportRule, \Magento\Framework\Locale\ResolverInterface $localeResolver, \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate)