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.

Était-ce utile?

La 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

Licencié sous: CC-BY-SA avec attribution
Non affilié à magento.stackexchange
scroll top