Question

I found a code at /vendor/magento/module-customer/Controller/Account/Login.php

/** @var Redirect $resultRedirect */ $resultRedirect = $this->resultRedirectFactory->create();

I want to know everything related to this object. which model or class it linked to and how does it work. The flow of the code and more information i need to have in this.

Was it helpful?

Solution

This "resultRedirectFactory" used to create redirect from your controller to another url

If you want to redirect it to another controller then simply create resultRedirectFactory and set path

$resultRedirect = $this->resultRedirectFactory->create();
$resultRedirect->setPath('sales/order/view') // syntax is frontname/controllerdirectory/controllerclass
return $resultRedirect;

At last just return and get redirect to the path you set

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top