11
11
use Magento \Framework \Registry ;
12
12
use Magento \Framework \Stdlib \DateTime \Filter \Date ;
13
13
use Magento \Framework \App \Request \DataPersistorInterface ;
14
- use Magento \Framework \Stdlib \DateTime \TimezoneInterface ;
15
14
16
15
/**
17
16
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -23,42 +22,35 @@ class Save extends \Magento\CatalogRule\Controller\Adminhtml\Promo\Catalog
23
22
*/
24
23
protected $ dataPersistor ;
25
24
26
- /**
27
- * @var TimezoneInterface
28
- */
29
- private $ localeDate ;
30
-
31
25
/**
32
26
* @param Context $context
33
27
* @param Registry $coreRegistry
34
28
* @param Date $dateFilter
35
29
* @param DataPersistorInterface $dataPersistor
36
- * @param TimezoneInterface $localeDate
37
30
*/
38
31
public function __construct (
39
32
Context $ context ,
40
33
Registry $ coreRegistry ,
41
34
Date $ dateFilter ,
42
- DataPersistorInterface $ dataPersistor ,
43
- TimezoneInterface $ localeDate
35
+ DataPersistorInterface $ dataPersistor
44
36
) {
45
37
$ this ->dataPersistor = $ dataPersistor ;
46
- $ this ->localeDate = $ localeDate ;
47
38
parent ::__construct ($ context , $ coreRegistry , $ dateFilter );
48
39
}
49
40
50
41
/**
51
42
* @return void
52
43
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
53
- * @SuppressWarnings(PHPMD.NPathComplexity)
54
44
*/
55
45
public function execute ()
56
46
{
57
47
if ($ this ->getRequest ()->getPostValue ()) {
48
+
58
49
/** @var \Magento\CatalogRule\Api\CatalogRuleRepositoryInterface $ruleRepository */
59
50
$ ruleRepository = $ this ->_objectManager ->get (
60
51
\Magento \CatalogRule \Api \CatalogRuleRepositoryInterface::class
61
52
);
53
+
62
54
/** @var \Magento\CatalogRule\Model\Rule $model */
63
55
$ model = $ this ->_objectManager ->create (\Magento \CatalogRule \Model \Rule::class);
64
56
@@ -68,9 +60,7 @@ public function execute()
68
60
['request ' => $ this ->getRequest ()]
69
61
);
70
62
$ data = $ this ->getRequest ()->getPostValue ();
71
- if (!$ this ->getRequest ()->getParam ('from_date ' )) {
72
- $ data ['from_date ' ] = $ this ->localeDate ->formatDate ();
73
- }
63
+
74
64
$ filterValues = ['from_date ' => $ this ->_dateFilter ];
75
65
if ($ this ->getRequest ()->getParam ('to_date ' )) {
76
66
$ filterValues ['to_date ' ] = $ this ->_dateFilter ;
0 commit comments