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