Skip to content

Commit 7428d21

Browse files
author
Yuri Kovsher
committed
MAGETWO-36105: Refactor controllers in the Persistent module
1 parent 499a233 commit 7428d21

File tree

3 files changed

+19
-16
lines changed

3 files changed

+19
-16
lines changed

app/code/Magento/Persistent/Controller/Index/ExpressCheckout.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class ExpressCheckout extends Index
1818
public function execute()
1919
{
2020
$this->messageManager->addNotice(__('Your shopping cart has been updated with new prices.'));
21+
/** @var \Magento\Framework\Controller\Result\Redirect $resultRedirect */
2122
$resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
2223
$resultRedirect->setPath('checkout/cart');
2324
return $resultRedirect;

app/code/Magento/Persistent/Controller/Index/SaveMethod.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ public function execute()
2525
$this->quoteManager->setGuest();
2626
}
2727
$checkoutUrl = $this->_redirect->getRefererUrl();
28+
/** @var \Magento\Framework\Controller\Result\Redirect $resultRedirect */
2829
$resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
29-
$resultRedirect->setPath($checkoutUrl . (strpos($checkoutUrl, '?') ? '&' : '?') . 'register');
30+
$resultRedirect->setUrl($checkoutUrl . (strpos($checkoutUrl, '?') ? '&' : '?') . 'register');
3031
return $resultRedirect;
3132
}
3233
}

app/code/Magento/Persistent/Controller/Index/UnsetCookie.php

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,22 @@
1010

1111
class UnsetCookie extends Index
1212
{
13+
/**
14+
* Unset persistent cookie action
15+
*
16+
* @return \Magento\Framework\Controller\Result\Redirect
17+
*/
18+
public function execute()
19+
{
20+
if ($this->sessionHelper->isPersistent()) {
21+
$this->cleanup();
22+
}
23+
/** @var \Magento\Framework\Controller\Result\Redirect $resultRedirect */
24+
$resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
25+
$resultRedirect->setPath('customer/account/login');
26+
return $resultRedirect;
27+
}
28+
1329
/**
1430
* Revert all persistent data
1531
*
@@ -25,19 +41,4 @@ protected function cleanup()
2541
$this->sessionHelper->getSession()->removePersistentCookie();
2642
return $this;
2743
}
28-
29-
/**
30-
* Unset persistent cookie action
31-
*
32-
* @return \Magento\Framework\Controller\Result\Redirect
33-
*/
34-
public function execute()
35-
{
36-
if ($this->sessionHelper->isPersistent()) {
37-
$this->cleanup();
38-
}
39-
$resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
40-
$resultRedirect->setPath('customer/account/login');
41-
return $resultRedirect;
42-
}
4344
}

0 commit comments

Comments
 (0)