File tree 1 file changed +15
-2
lines changed
1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -20,15 +20,24 @@ class View extends \Magefan\Blog\App\Action\Action
20
20
protected $ _storeManager ;
21
21
22
22
/**
23
+ * @var \Magefan\Blog\Model\Url
24
+ */
25
+ protected $ url ;
26
+
27
+ /**
28
+ * View constructor.
23
29
* @param \Magento\Framework\App\Action\Context $context
24
30
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
31
+ * @param \Magefan\Blog\Model\Url|null $url
25
32
*/
26
33
public function __construct (
27
34
\Magento \Framework \App \Action \Context $ context ,
28
- \Magento \Store \Model \StoreManagerInterface $ storeManager
35
+ \Magento \Store \Model \StoreManagerInterface $ storeManager ,
36
+ \Magefan \Blog \Model \Url $ url = null
29
37
) {
30
38
parent ::__construct ($ context );
31
39
$ this ->_storeManager = $ storeManager ;
40
+ $ this ->url = $ url ?: $ this ->_objectManager ->get (\Magefan \Blog \Model \Url::class);
32
41
}
33
42
34
43
/**
@@ -43,8 +52,12 @@ public function execute()
43
52
}
44
53
45
54
$ category = $ this ->_initCategory ();
55
+
46
56
if (!$ category ) {
47
- return $ this ->_forwardNoroute ();
57
+ $ resultRedirect = $ this ->resultRedirectFactory ->create ();
58
+ $ resultRedirect ->setHttpResponseCode (301 );
59
+ $ resultRedirect ->setPath ($ this ->url ->getBaseUrl ());
60
+ return $ resultRedirect ;
48
61
}
49
62
50
63
$ this ->_objectManager ->get (\Magento \Framework \Registry::class)
You can’t perform that action at this time.
0 commit comments