Skip to content

Commit 1324bdd

Browse files
author
Dmytro Poperechnyy
committed
Merge remote-tracking branch 'tango/result_factory' into MAGETWO-36113
2 parents 948f734 + 9fc9515 commit 1324bdd

File tree

4 files changed

+49
-2
lines changed

4 files changed

+49
-2
lines changed

app/code/Magento/Backend/App/Action/Context.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66
namespace Magento\Backend\App\Action;
77

8+
use Magento\Framework\Controller\ResultFactory;
9+
810
/**
911
* Backend Controller context
1012
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -62,6 +64,7 @@ class Context extends \Magento\Framework\App\Action\Context
6264
* @param \Magento\Framework\App\ViewInterface $view
6365
* @param \Magento\Framework\Message\ManagerInterface $messageManager
6466
* @param \Magento\Backend\Model\View\Result\RedirectFactory $resultRedirectFactory
67+
* @param \Magento\Framework\Controller\ResultFactory $resultFactory
6568
* @param \Magento\Backend\Model\Session $session
6669
* @param \Magento\Framework\AuthorizationInterface $authorization
6770
* @param \Magento\Backend\Model\Auth $auth
@@ -83,6 +86,7 @@ public function __construct(
8386
\Magento\Framework\App\ViewInterface $view,
8487
\Magento\Framework\Message\ManagerInterface $messageManager,
8588
\Magento\Backend\Model\View\Result\RedirectFactory $resultRedirectFactory,
89+
ResultFactory $resultFactory,
8690
\Magento\Backend\Model\Session $session,
8791
\Magento\Framework\AuthorizationInterface $authorization,
8892
\Magento\Backend\Model\Auth $auth,
@@ -102,7 +106,8 @@ public function __construct(
102106
$actionFlag,
103107
$view,
104108
$messageManager,
105-
$resultRedirectFactory
109+
$resultRedirectFactory,
110+
$resultFactory
106111
);
107112

108113
$this->_session = $session;

app/code/Magento/Backend/etc/adminhtml/di.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,24 @@
9090
<argument name="instanceName" xsi:type="string">Magento\Backend\Model\View\Result\Page</argument>
9191
</arguments>
9292
</type>
93+
<type name="Magento\Framework\Controller\ResultFactory">
94+
<arguments>
95+
<argument name="typeMap" xsi:type="array">
96+
<item name="redirect" xsi:type="array">
97+
<item name="type" xsi:type="const">Magento\Framework\Controller\ResultFactory::TYPE_REDIRECT</item>
98+
<item name="class" xsi:type="string">Magento\Backend\Model\View\Result\Redirect</item>
99+
</item>
100+
<item name="page" xsi:type="array">
101+
<item name="type" xsi:type="const">Magento\Framework\Controller\ResultFactory::TYPE_PAGE</item>
102+
<item name="class" xsi:type="string">Magento\Backend\Model\View\Result\Page</item>
103+
</item>
104+
<item name="forward" xsi:type="array">
105+
<item name="type" xsi:type="const">Magento\Framework\Controller\ResultFactory::TYPE_FORWARD</item>
106+
<item name="class" xsi:type="string">Magento\Backend\Model\View\Result\Forward</item>
107+
</item>
108+
</argument>
109+
</arguments>
110+
</type>
93111
<type name="Magento\Framework\View\Layout\BuilderFactory">
94112
<arguments>
95113
<argument name="typeMap" xsi:type="array">

lib/internal/Magento/Framework/App/Action/AbstractAction.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ abstract class AbstractAction implements \Magento\Framework\App\ActionInterface
2424
*/
2525
protected $resultRedirectFactory;
2626

27+
/**
28+
* @var \Magento\Framework\Controller\ResultFactory
29+
*/
30+
protected $resultFactory;
31+
2732
/**
2833
* @param \Magento\Framework\App\Action\Context $context
2934
*/
@@ -33,6 +38,7 @@ public function __construct(
3338
$this->_request = $context->getRequest();
3439
$this->_response = $context->getResponse();
3540
$this->resultRedirectFactory = $context->getResultRedirectFactory();
41+
$this->resultFactory = $context->getResultFactory();
3642
}
3743

3844
/**

lib/internal/Magento/Framework/App/Action/Context.php

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66
namespace Magento\Framework\App\Action;
77

8+
use Magento\Framework\Controller\ResultFactory;
9+
810
class Context implements \Magento\Framework\ObjectManager\ContextInterface
911
{
1012
/**
@@ -57,6 +59,11 @@ class Context implements \Magento\Framework\ObjectManager\ContextInterface
5759
*/
5860
protected $resultRedirectFactory;
5961

62+
/**
63+
* @var \Magento\Framework\Controller\ResultFactory
64+
*/
65+
protected $resultFactory;
66+
6067
/**
6168
* @param \Magento\Framework\App\RequestInterface $request
6269
* @param \Magento\Framework\App\ResponseInterface $response
@@ -68,6 +75,7 @@ class Context implements \Magento\Framework\ObjectManager\ContextInterface
6875
* @param \Magento\Framework\App\ViewInterface $view
6976
* @param \Magento\Framework\Message\ManagerInterface $messageManager
7077
* @param \Magento\Framework\Controller\Result\RedirectFactory $resultRedirectFactory
78+
* @param \Magento\Framework\Controller\ResultFactory $resultFactory
7179
*
7280
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
7381
*/
@@ -81,7 +89,8 @@ public function __construct(
8189
\Magento\Framework\App\ActionFlag $actionFlag,
8290
\Magento\Framework\App\ViewInterface $view,
8391
\Magento\Framework\Message\ManagerInterface $messageManager,
84-
\Magento\Framework\Controller\Result\RedirectFactory $resultRedirectFactory
92+
\Magento\Framework\Controller\Result\RedirectFactory $resultRedirectFactory,
93+
ResultFactory $resultFactory
8594
) {
8695
$this->_request = $request;
8796
$this->_response = $response;
@@ -93,6 +102,7 @@ public function __construct(
93102
$this->_view = $view;
94103
$this->messageManager = $messageManager;
95104
$this->resultRedirectFactory = $resultRedirectFactory;
105+
$this->resultFactory = $resultFactory;
96106
}
97107

98108
/**
@@ -174,4 +184,12 @@ public function getResultRedirectFactory()
174184
{
175185
return $this->resultRedirectFactory;
176186
}
187+
188+
/**
189+
* @return \Magento\Framework\Controller\ResultFactory
190+
*/
191+
public function getResultFactory()
192+
{
193+
return $this->resultFactory;
194+
}
177195
}

0 commit comments

Comments
 (0)