6
6
*/
7
7
namespace Magento \Catalog \Controller \Adminhtml \Category ;
8
8
9
- use Magento \Framework \App \Action \HttpGetActionInterface as HttpGetActionInterface ;
9
+ use Magento \Backend \App \Action \Context ;
10
+ use Magento \Backend \Model \View \Result \Page ;
11
+ use Magento \Framework \Controller \ResultFactory ;
12
+ use Magento \Backend \Model \View \Result \Redirect ;
13
+ use Magento \Framework \Controller \ResultInterface ;
14
+ use Magento \Catalog \Controller \Adminhtml \Category ;
15
+ use Magento \Backend \Model \View \Result \ForwardFactory ;
16
+ use Magento \Framework \App \Action \HttpGetActionInterface ;
10
17
11
18
/**
12
19
* Class Add Category
13
20
*
14
21
* @package Magento\Catalog\Controller\Adminhtml\Category
15
22
*/
16
- class Add extends \ Magento \ Catalog \ Controller \ Adminhtml \ Category implements HttpGetActionInterface
23
+ class Add extends Category implements HttpGetActionInterface
17
24
{
18
25
/**
19
26
* Forward factory for result
20
27
*
21
- * @var \Magento\Backend\Model\View\Result\ForwardFactory
28
+ * @deprecated Unused Class: ForwardFactory
29
+ * @see $this->resultFactory->create()
30
+ * @var ForwardFactory
31
+ *
22
32
*/
23
33
protected $ resultForwardFactory ;
24
34
25
35
/**
26
36
* Add category constructor
27
37
*
28
- * @param \Magento\Backend\App\Action\ Context $context
29
- * @param \Magento\Backend\Model\View\Result\ ForwardFactory $resultForwardFactory
38
+ * @param Context $context
39
+ * @param ForwardFactory $resultForwardFactory
30
40
*/
31
41
public function __construct (
32
- \ Magento \ Backend \ App \ Action \ Context $ context ,
33
- \ Magento \ Backend \ Model \ View \ Result \ ForwardFactory $ resultForwardFactory
42
+ Context $ context ,
43
+ ForwardFactory $ resultForwardFactory
34
44
) {
35
45
parent ::__construct ($ context );
36
46
$ this ->resultForwardFactory = $ resultForwardFactory ;
@@ -39,15 +49,15 @@ public function __construct(
39
49
/**
40
50
* Add new category form
41
51
*
42
- * @return \Magento\Backend\Model\View\Result\Forward
52
+ * @return ResultInterface
43
53
*/
44
54
public function execute ()
45
55
{
46
56
$ parentId = (int )$ this ->getRequest ()->getParam ('parent ' );
47
57
48
58
$ category = $ this ->_initCategory (true );
49
59
if (!$ category || !$ parentId || $ category ->getId ()) {
50
- /** @var \Magento\Backend\Model\View\Result\ Redirect $resultRedirect */
60
+ /** @var Redirect $resultRedirect */
51
61
$ resultRedirect = $ this ->resultRedirectFactory ->create ();
52
62
return $ resultRedirect ->setPath ('catalog/*/ ' , ['_current ' => true , 'id ' => null ]);
53
63
}
@@ -61,9 +71,8 @@ public function execute()
61
71
$ category ->addData ($ categoryData );
62
72
}
63
73
64
- $ resultPageFactory = $ this ->_objectManager ->get (\Magento \Framework \View \Result \PageFactory::class);
65
- /** @var \Magento\Backend\Model\View\Result\Page $resultPage */
66
- $ resultPage = $ resultPageFactory ->create ();
74
+ /** @var Page $resultPage */
75
+ $ resultPage = $ this ->resultFactory ->create (ResultFactory::TYPE_PAGE );
67
76
68
77
if ($ this ->getRequest ()->getQuery ('isAjax ' )) {
69
78
return $ this ->ajaxRequestResponse ($ category , $ resultPage );
0 commit comments